Android Studio 中具有 cpu 架构的多个构建变体
Posted
技术标签:
【中文标题】Android Studio 中具有 cpu 架构的多个构建变体【英文标题】:Multiple build variants with cpu architectures in Android Studio 【发布时间】:2019-10-12 20:48:50 【问题描述】:我正在 android Studio 中设置 Product Flavor,在工作室中创建了多个构建变体
喜欢
FlavourDebug1-armeabi-v7a
FlavourDebug1-arm64-v8a
FlavourDebug1-x86
FlavourDebug1-x86_64
FlavourRelease1-armeabi-v7a
FlavourRelease1-arm64-v8a
FlavourRelease1-x86
FlavourRelease1-x86_64
=============
如何删除它并只得到
调试
发布
android
compileSdkVersion 28
defaultConfig
applicationId "com.xxx.smart.xx.launcher"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild
cmake
cppFlags "-std=c++14"
ndk
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
javaCompileOptions
annotationProcessorOptions
arguments = ['objectbox.debug': 'true']
buildTypes
debug
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
externalNativeBuild
cmake
path "src/main/cpp/CMakeLists.txt"
compileOptions
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
flavorDimensions "version"
productFlavors
ChoiceIPTVFlavour
applicationId 'com.xxx.smart.xx.launcher'
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
PurpleIPTVFlavour
minSdkVersion 21
applicationId 'com.xxx.smart.xx.launcher'
targetSdkVersion 28
versionCode 1
versionName '1.0'
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
【问题讨论】:
【参考方案1】:从你的 gradle 中删除这样的代码
splits
abi
enable true
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "armeabi-v7a", "arm64-v8a", "armeabi", "mips", "mips64"
universalApk true //generate an additional APK that contains all the ABIs
【讨论】:
我删除了该代码,但构建变体在架构方面是可用的 你能发布你的 build.gradle 也尝试删除它 -> ndk abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64" ............警告删除它会增加您的应用程序大小 移除拆分和 ndk abiFilters 但构建变体在架构方面可用 ***.com/questions/28249036/…以上是关于Android Studio 中具有 cpu 架构的多个构建变体的主要内容,如果未能解决你的问题,请参考以下文章
错误记录Visual Studio 中配置 NDK 头文件路径 ( NDK 的三个头文件路径 | 与 CPU 架构相关 asm 头文件路径选择 )