Android Lab

Resources for Android Development

Creative Commons License
This work by José Juan Sánchez Hernández is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

NDK (Native Development Kit)

JNI (Java Native Interface)

Examples


Advantages and Disadvantages

Advantages

Disadvantages

The advantages of using native code do not come free. Calling JNI methods introduces extra work for the Dalvik VM and since the code is compiled, no runtime optimization can be applied. In fact, developing in NDK doesn’t guarantee a performance improvement and can actually harm performance at times. Therefore, we only stated that it may improve the app’s performance.

Before we decide to use NDK for an Android app, it is good to know that NDK will not benefit most Android apps. It is not recommended to work in NDK simply because one prefers programming in C or C++ over Java. NDK cannot access lots of APIs available in the Android SDK directly, and developing in NDK will always introduce extra complexity into your application.

« Go back