Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NDK Support Version Limited

I have used Android NDK for years, however, recently, I saw the message below when I built CPPs using ndk-build(ndk version 15)

Android NDK: android-9 is unsupported. Using minimum supported version android-14. Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 9

Why does NDK stop supporting Android levels(3-13) lower than android-14?

I tried to find out why at NDK guides, https://developer.android.com/ndk/guides/stable_apis.html although I still have no idea. It seems NDK still supports higher than or equal to level 3.

I also guessed that one of flags or features I need in c++ may cause this. However, I could not even find any clue so far.

LOCAL_CPP_FEATURES := rtti exceptions
APP_CPPFLAGS += -std=c++11
APP_STL := gnustl_static

 

like image 495
Sung Avatar asked Aug 15 '17 01:08

Sung


People also ask

Which version of NDK 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.

Which is better NDK or SDK?

You really should use SDK, unless you have a good reason to use NDK. Good reasons may vary, but for example, you could use NDK: If you want to use OpenGL ES 2.0 for Android 2.1 (Eclair), it is only avaiable through NDK.

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. NDK is a complex and advanced topics.


2 Answers

Don't update NDK version 15 if your apps should run on android-9

According to NDK Revision History (https://developer.android.com/ndk/downloads/revision_history.html),

Android 2.3 (android-9) is no longer supported. The minimum API level target in the NDK is now Android 4.0 (android-9). If your APP_PLATFORM is set lower than android-14, android-14 is used instead.

like image 58
MM S Avatar answered Sep 29 '22 08:09

MM S


Your question 'why' should be addressed to the NDK team. You can ask them at the public mail list or open a complaint at GitHub.

Anyways, for now their verdict is to stop supporting old devices. Expect next releases of NDK to cut the platform requirements further.

The interesting question is what you should do about this. If you care about android-9 much more than android-26, you can simply continue to use an older release of NDK. It won't just stop working. It doesn't have an expiration date.

Normally, Android preserves backwards compatibility: if an app was built for platform-X, it will run (maybe in compatibility mode) on platform-(X+n).

On the other hand, the new releases of NDK have important bug fixes, including security fixes. The new devices (e.g. platform 'O') may have problems running binaries compiled with old NDK. And definitely, the old NDK will not give you access to the new features that are only available on advanced platforms.

Therefore, it may be worthwhile to upload two different APKs - one, with target SDK=9, and another with min SDK=21 (your numbers may vary). Play Store allows maintaining separate APKs for different platforms (and ABIs). You should only be careful about version code policy, and then your users will receive their updates timely - those who are stuck with Eclair, and those who upgrade to Nougat.

like image 22
Alex Cohn Avatar answered Sep 29 '22 10:09

Alex Cohn