The new NDK support in Android Studio

During Google I/O 2015, end of May, Google announced a new support for the NDK by Android Studio 1.3, integrating Jetbrains CLion capabilities, and the Android gradle plugin. This support has been released only in July, and while it’s really promising, it’s still in heavy development.

The new NDK support requires the use of Android Studio 1.3 RC1+/2.0+ and the android gradle-experimental plugin. This article is for those who are willing to give it a try. If you’re looking into the NDK support while using the gradle(-stable) plugin, you can check this older (but still up-to-date) article on the NDK and Android Studio.

last update – 2016/09/20: Android Studio 2.2 now supports external CMake and ndk-build tools very well. It’s in my view much better than the gradle-experimental plugin explained here. Please follow this guide to learn how to use it: 

Continue reading The new NDK support in Android Studio

What you should know about .so files

In its early days, the Android OS was pretty much supporting only one CPU architecture: ARMv5.
Do you know how many it does support now? … 7!

Seven distinct CPU-architectures are currently supported by the Android OS: ARMv5, ARMv7 (since 2010), x86 (2011), MIPS (2012), ARMv8, MIPS64 and x86_64 (2014). Each of them is associated with a respective ABI.

An Application Binary Interface is the definition of how binaries (esp. .so files) should be made in order to work on the platform, from the instruction set used and memory alignment, to the system libraries that are available. On Android there is one per CPU architecture:  armeabi, armeabi-v7a, x86, mips, arm64-v8a, mips64, x86_64.

Continue reading What you should know about .so files

Getting Battery Historian 2.0 to work on Windows

Last updated on 3/25/16

If you’ve never heard about Battery Historian, you can first have a look at the official page and some of Android Performance Patterns videos. Then, come back here if you’re using Windows, to get ready fixing your app 🙂

The first version of Battery Historian released last year was a simple cross-platform Python script. Two weeks ago, during Google I/O 15, a new version of Battery Historian (2.0!) has been quietly released.

This new release brings a lot of welcome improvements: more clarity in the reports, per-app summaries, a quicker execution, the presence of a Readme, etc.

While all these new features are awesome, Battery Historian got more complicated to install because of the addition of many dependencies and all its documentation and internal scripts are written for Unix compatible systems (Linux and Mac OSX). So out of the box, it’s simply not working on Windows.

Continue reading Getting Battery Historian 2.0 to work on Windows

Porting an Android app to Android TV and the Nexus Player

The Nexus Player is the Android TV Nexus device from Google.

This device, made by Asus embeds 8GB memory, 1GB of ram, costs 99$ and features an Intel® SOC, the Atom Z3560 (codenamed Moorefield). That means it has got a 4-cores 64-bit Silvermont CPU clocked at 1.83 Ghz and a PowerVR Series 6 GPU (G6430) that supports OpenGL ES 3.1.

Let’s look at how you can port your app to this device and Android TV in general.

Continue reading Porting an Android app to Android TV and the Nexus Player

Getting an x86 version of JavaCV for Android

JavaCV is a wrapper of mainly OpenCV and ffmpeg libraries. While these libs are perfectly compatible with x86 flavor of Android, JavaCV doesn’t provide the build scripts nor it integrate the x86 binaries.

It doesn’t take much to compile the proper x86 versions of JavaCV packages, but if you’re in a hurry, here they are:

Continue reading Getting an x86 version of JavaCV for Android

Adding dev tools (gcc, make…) to Galileo SD image and using nodejs with native extensions

Galileo is an Arduino that runs on a (x86) Intel® Quark X1000 SOC.IntelGalileo_fabD_Front_450px

While it’s fully compatible with Arduino Software Development Environment, it’s also capable of running a full Linux distribution.

Sept. 2014 update: GCC and other dev tools are now part of the official linux image you can download from Intel Developer Zone.

Continue reading Adding dev tools (gcc, make…) to Galileo SD image and using nodejs with native extensions

Android Studio, gradle and NDK integration

With the recent changes (release 0.7.3 around Dec 27), the new Android Build System starts to be really interesting also if you are using the NDK!

Now this is really easy to integrate native libraries in your package and generate APKs for different architectures while correctly handling version codes (for more information on why this may be important, please refer to my first article).

update 2015/08/10: this article remains fully up-to-date if you’re using the recent Android Studio and the stable Android gradle plugin (set android.useDeprecatedNdk=true inside Another article on gradle-experimental is in the work!

Continue reading Android Studio, gradle and NDK integration

x86 version of AllJoyn for Android platforms

Alljoyn is a cross-platform library designed for peer-to-peer communication between various devices over different transports.

This library is open-source (Apache License) and initially created by Qualcomm Innovation Center. The project has joined the AllSeen Alliance two days ago and now it’s hosted here:

Even if the precompiled x86 version isn’t distributed from the official website, compiling it from the sources is perfectly supported.

Continue reading x86 version of AllJoyn for Android platforms

Porting libaacdecoder to x86

Latest update: the maintainer of the lib accepted my patch, 0.7+ release packages now include x86 libs: aacdecoder releases

Porting is a big word here ! As often, adding x86 support to libaacdecoder was a matter of fixing Makefiles.

libaacdecoder supports AAC as well as MP3 decoding through the use of OpenCore decoders. It’s based on opencore-aacdec which compiles fine for x86.

The release package, as of 0.6.1, includes only binaries for ARMv5 and ARMv7. If you try to recompile it by yourself from the sources, you may even think that other architectures aren’t supported… but this is wrong!

Continue reading Porting libaacdecoder to x86

How to improve x86 support of Android apps, libs, engines

Since this is my first blog post here, I owe you an introduction!

One of my goals here is to share my experience on improving the x86 compatibility of various libraries and game engines on Android. This is part of my job at Intel and I hope that sharing this will be useful for others… especially if you’re a developer googling around because of some cryptic toolchain or compiler errors 🙂

Let’s start by explaining what it generally involves to do this and why it matters in the first place. I swear my next blog posts will be more focused on the technical details.

Continue reading How to improve x86 support of Android apps, libs, engines