I’m trying to better understand how the selection of the api level works when using ndk-build.
I know I can explicitly set APP_PLATFORM in Application.mk, and that otherwise ndk-build will target the api indicated in the manifest with android:minSdkVersion, but what if my application’s manifest has both android:minSdkVersion and android:targetSdkVersion, and this is higher than minSdkVersion?
Will ndk-build target the targetSdkVersion? And how can I check that?
In case it targets the higher api level, I guess that I will be able to build using native apis only available for that level, but if I run the application on a device with lower api level it should miserably fail, so in that case I should implement some sort of api level checking, is that correct?
Put this code into your
Android.mkjust after you define TARGET_PLATFORM and LOCAL_CFLAGSNow you can check this defines in your C/C++ code: