Perraco
Perraco

Reputation: 17380

Android NDK multiple API Levels

Is it possible to define a minimum API level and a target API level in NDK, same as in the java manifest?

I only know I can use APP_PLATFORM to specify the target, but what if I want to set also that the minimum API?

Upvotes: 3

Views: 6548

Answers (1)

Alex Bitek
Alex Bitek

Reputation: 6557

No. You can't specify that kind of information inside the NDK build system because each version of Android system image is different.

And for native code the portability aspect is different than when your application is written in Java only.

You will most probably have to compile your code against different APP_PLATFORM's if you want to support different versions of Android with native code.

As you said, you can only use the APP_PLATFORM directive inside the Application.mk file, which is documented as:

APP_PLATFORM = Name the target Android platform. For example, 'android-3' correspond to Android 1.5 system images. For a complete list of platform names and corresponding Android system images, read docs/STABLE-APIS.html.

Parts from docs/STABLE-APIS.html (android-ndk-r8d):

There are several "API Levels" defined. Each API level corresponds to a given Android system platform release. The following levels are currently supported:

android-3      -> Official Android 1.5 system images
android-4      -> Official Android 1.6 system images
android-5      -> Official Android 2.0 system images
android-6      -> Official Android 2.0.1 system images
android-7      -> Official Android 2.1 system images
android-8      -> Official Android 2.2 system images
android-9      -> Official Android 2.3 system images
android-14     -> Official Android 4.0 system images

Note that android-6 and android-7 are the same as android-5 for the NDK, i.e. they provide exactly the same native ABIs!

IMPORTANT: The headers corresponding to a given API level are now located under $NDK/platforms/android-/arch-arm/usr/include

Upvotes: 4

Related Questions