Andreas
Andreas

Reputation: 10067

Why does the Android NDK miss out on certain API levels?

I've just installed the latest Android Studio and Android NDK. When examining the platforms directory of my NDK installation, I can see the following platforms:

android-9
android-12
android-13
android-14
android-15
android-16
android-17
android-18
android-19
android-21
android-22
android-23
android-24

You can see that the API levels 10, 11, 20 and 25 are missing in the NDK. So why is that?

And what if my app should target API level 11? What should I define as ANDROID_PLATFORM in that case? I've tried the following and it seems to work although there is no android-11 directory in my NDK:

externalNativeBuild {
    cmake {
        arguments '-DANDROID_PLATFORM=android-11',
                  '-DANDROID_TOOLCHAIN=clang'
    }
}

Is this the right way to target API level 11? It's slightly confusing to me because it seems to work but as I said, there is no android-11 directory in my NDK installation...

Thanks for anybody who can shed some light onto this!

Upvotes: 2

Views: 3178

Answers (2)

Alex Cohn
Alex Cohn

Reputation: 57183

You can find the answer to your question in NDK guide. The bottom line is, not all system upgrades involved changes to public (stable) native APIs, and therefore don't have a separate directory under platforms. For example, to have your native libs compatible with API 11 (HONEYCOMB) you should use platforms/android-9.

Android NDK in general, and specifically CMake utilities for Android Studio, are aware of this rule, and explicitly enforce it here.

Please note that recent NDK (r14) has dropped support for platforms below API 9 (GINGERBREAD).

Update there is a bug in NDK r15: it does not treat correctly the missing android-25 folder. So, if your Android project has minSdkVersion 25, you should manually choose APP_PLATFORM=android-24 (or '-DANDROID_PLATFORM=android-24' if you use cmake).

Upvotes: 6

Armen Avetisyan
Armen Avetisyan

Reputation: 1258

From a chat with an android-ndk guy I know that api 25 does not exist because "there were no new features since version 24".

Upvotes: 0

Related Questions