Building Android Apps using the Android NDK

Steps how to develop an Android App that includes C/C++ code with the Android NDK.

Install AIDE from Google Play on your Android device (all Android versions from 2.2 are supported) and start it.

The AIDE app does not itself include the NDK. Instead it will install a mobile version of the NDK on your device once it is needed. You can either start the installation manually in the settings. Alternatively, AIDE will also ask to install if you create a new NDK based project or open an existing one.

There are two ways to use the NDK: Either write your application in Java/Xml using the Android SDK and use JNI to access the APIs implemented in C/C++ using the Android NDK. Or write a native activity in C/C++, which allows you to implement the lifecycle callbacks in native code. AIDE supports both scenarios and comes with sample apps for both. Create a new app project as described in the tutorial about Building your first App but choose one of the "C/Java/Xml" projects. You will see that some C files are part of these projects. You can use AIDE to work on the C code as well now. You will see errors in C/C++ code once you run the app and the code is compiled.

Running an NDK app project works as normal by selecting "Run" from the menu. AIDE will use the installed NDK to compile the C/C++ code of your app and run the app afterwards.