如何在Android Studio的Gradle NDK插件中设置APP_PLATFORM? [英] How do you set APP_PLATFORM in Gradle NDK plug-in in Android Studio?
问题描述
我正在使用Android Studio 1.5.1和 Gradle实验性插件0.4.0 .
I'm building an app with an NDK library using Android Studio 1.5.1 and the Gradle experimental plugin 0.4.0.
即使Gradle配置是这样设置的(使用minSdkVersion.apiLevel = 18
),似乎NDK库仍是为android-21
编译的:
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
}
}
是因为Gradle NDK支持不会根据最小SDK版本自动设置APP_PLATFORM
吗?如果是这样,您如何解决呢?
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?
推荐答案
您可以设置以下内容:
android.ndk {
platformVersion = "19"
}
有关详细信息,请参见 https://stackoverflow.com/a/33982735/3115956 . (实际上,我认为您的库是针对android-23
构建的,它的作用与针对android-21
的作用相同-compileSdkVersion
是会影响它的(针对Java和本机代码,除非覆盖本机的) ).
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).
这篇关于如何在Android Studio的Gradle NDK插件中设置APP_PLATFORM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!