如何减少Android Studio 3.3中本机库的构建变体? [英] How to reduce build variants of native library in Android Studio 3.3?
问题描述
在Android Studio 3.2.1中,我的本机库有两个可见的构建变体. 发布和 Debug .在3.3中,我将这些ABI和所有ABI结合在一起.我不想为所有ABI构建多个APK.
In Android Studio 3.2.1 I had two build variants visible for my native library; Release and Debug. In 3.3 I get a combination of these and all ABIs. I don't want to build multiple APKs for all the ABIs.
本机库项目的相关部分:
The relevant parts of the native library project:
apply plugin: 'com.android.library'
android {
defaultConfig {
ndk {
// Specifies the ABI configurations of your native
// libraries Gradle should build and package with your APK.
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
buildTypes {
release {
}
debug {
}
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
sourceSets {
main {
java.srcDir generatedSrcDir
}
}
sourceSets {
main {
jni.srcDirs = []
}
}
}
构建警告
也许无关,但是我在构建日志中观察到了这个警告(实际上连续两次):
Maybe unrelated, but I observed this warning in the Build log (actually twice in a row):
警告:ABI [arm64-v8a,armeabi-v7a,armeabi]由 'android.injected.build.abi'gradle标志不包含'ARMEABI' 该项目的目标.
WARNING: ABIs [arm64-v8a,armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contained 'ARMEABI' not targeted by this project.
如何恢复以前的行为?
推荐答案
显然,这是有意更改:请参见这个问题.
Apparently this is an intentional change: see this issue.
根据链接的票证,这仅是化妆品"(即用户界面更改);仍然完整/胖的.apk.
According to the linked ticket, this is only "cosmetic"(ie a UI change); a full/fat .apk is still built.
这篇关于如何减少Android Studio 3.3中本机库的构建变体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!