我能够在 Android Studio v3.2.1 中将构建变体更改为 devDebug、devRelease、playStoreDebug、playStoreRelease,在更新到 v3.3.1 后,我无法更改构建变体,请参阅Image_In_Android_studio_3.3.1。
在此处发布问题之前,我尝试了以下步骤:- 1. 清理项目/重建/无效缓存并重新启动项目 2. 重新克隆存储库(因为它不适用于现有存储库)。
- 已更新 - “classpath 'com.android.tools.build:gradle:3.3.1'”根 gradle 文件和“distributionUrl=https://services.gradle.org/distributions/gradle-4.10.1-all.zip”在 gradle-wrapper.properties
build.gradle 版本 1
signingConfigs {
release {
storeFile file("$project.rootDir/xyz-keystore-release.jks")
storePassword “xyzzy”
keyAlias "xyzzy"
keyPassword "xyzzy"
}}
buildTypes {
release {
minifyEnabled false
shrinkResources false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}}
productFlavors {
playStore {
applicationId myApplicationId
manifestPlaceholders = [crashlyticsEnabled: true]
}
dev {
applicationId myApplicationId + ".dev"
manifestPlaceholders = [crashlyticsEnabled: false]
}}
build.gradle 版本 2
signingConfigs {
release {
storeFile file("$project.rootDir/xyz-keystore-release.jks")
storePassword “xyzzy”
keyAlias "xyzzy"
keyPassword "xyzzy"
}
debug {
storeFile file("$project.rootDir/xyz-debug.keystore")
storePassword "xyzzy"
keyAlias "xyzzy"
keyPassword "xyzzy"
}}
buildTypes {
release {
minifyEnabled false
shrinkResources false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
shrinkResources false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}}
productFlavors {
playStore {
applicationId myApplicationId
manifestPlaceholders = [crashlyticsEnabled: true]
}
dev {
applicationId myApplicationId + ".dev"
manifestPlaceholders = [crashlyticsEnabled: false]
}}
使用 Android studio v3.2.1 中的“build.gradle version 1”,我能够更改构建变体,更新到 Android studio v3.3.1 后,我无法更改。