Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relation between the NDK version and the Android version

Is there any relation (constraint/compatibility restriction) between the version of the NDK used to compile the native code and the Android version running on the device where the APK is installed?
For example, I compile the native code with Android NDK r7, I get the libraries and generate APK1; then I compile with NDK r10d, obtain the libraries and generate APK2.

Is it any risk that I might get different behavior between APK1 and APK2 running on the same device?

like image 924
Traian Avatar asked Nov 02 '15 00:11

Traian


People also ask

How do I know what version of Android NDK I have?

Go to Tools->SDK Manager (or Files->Settings->Appearance & Behavior->System Settings->Android SDK ). Then select the SDK Tools tab, and check the Show Package Details checkbox. You will see your NDK version.

Is NDK backwards compatible?

Yes. All NDKs should be compatible with all platform versions except in very rare circumstances.

What NDK version should I use?

Android platform compatibility The native libraries created by the Android NDK can only be used on devices running the Android 1.5 platform version or later. This is due to toolchain and ABI related changes that make the native libraries incompatible with 1.0 and 1.1 system images.

What is difference between Android NDK and sdk?

Android provides Native Development Kit (NDK) to support native development in C/C++, besides the Android Software Development Kit (Android SDK) which supports Java. [TODO] more.


1 Answers

Bugs are found and fixed in NDK. So the later versions are generally better. But bugs may be introduced in later versions, so keep tracking the forums (e.g. SO and groups/android-ndk), track issues, and be ready to upgrade at any time.

The compilers included in NDK improve with the time, including optimizations. So, later versions may produce faster executables.

Also, while the 64-bit systems can run 32-bit executables, later NDK versions can produce native 64 bit binaries that will be much faster on such devices.

Don't confuse the NDK release with the platform! Even r.10e has support for all older platforms, but if you build your app for android-21, it won't load on devices with Froyo. On the other hand, forward comparability is usually OK, and mostly programs built for android-9 will run on all newest devices, but there may be glitches, and such binaries may underutilize the new platform, and be less efficient than the ones compiled for the highest platform.

like image 118
Alex Cohn Avatar answered Oct 07 '22 05:10

Alex Cohn