I'm building an app with an NDK library using Android Studio 1.5.1 and the Gradle experimental plugin 0.4.0.
Even though the Gradle config is set as such (with minSdkVersion.apiLevel = 18
), it seems like the NDK library is still compiled for android-21
:
compileOptions.with {
sourceCompatibility=JavaVersion.VERSION_1_7
targetCompatibility=JavaVersion.VERSION_1_7
}
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "net.pol_online.hyper"
minSdkVersion.apiLevel = 18 // Android 4.3 Jelly Bean
targetSdkVersion.apiLevel = 23 // Android 6.0 Marshmallow
}
}
Is it because APP_PLATFORM
is not automatically set by the Gradle NDK support based on the min SDK version? If so how do you fix this?
You can set this:
android.ndk {
platformVersion = "19"
}
See https://stackoverflow.com/a/33982735/3115956 for details on this. (In practice, I think your library is built targeting android-23
, which has the same effect as targeting android-21
- compileSdkVersion
is the one that affects it (for both the java and native code, unless the native one is overridden).