당신이
android {
compileSdkVersion 24
...
flavorDimensions "default"
...
}
을이 줄을 사용해야하지만 TI 사용 치수를 원하는 경우 먼저 차원 이름을 선언하고 후이 이름을 사용한다 치수를 사용하지 않도록하려면 이 예제는 문서에서 나온 것입니다 :
android {
...
buildTypes {
debug {...}
release {...}
}
// Specifies the flavor dimensions you want to use. The order in which you
// list each dimension determines its priority, from highest to lowest,
// when Gradle merges variant sources and configurations. You must assign
// each product flavor you configure to one of the flavor dimensions.
flavorDimensions "api", "mode"
productFlavors {
demo {
// Assigns this product flavor to the "mode" flavor dimension.
dimension "mode"
...
}
full {
dimension "mode"
...
}
// Configurations in the "api" product flavors override those in "mode"
// flavors and the defaultConfig block. Gradle determines the priority
// between flavor dimensions based on the order in which they appear next
// to the flavorDimensions property above--the first dimension has a higher
// priority than the second, and so on.
minApi24 {
dimension "api"
minSdkVersion 24
// To ensure the target device receives the version of the app with
// the highest compatible API level, assign version codes in increasing
// value with API level. To learn more about assigning version codes to
// support app updates and uploading to Google Play, read Multiple APK Support
versionCode 30000 + android.defaultConfig.versionCode
versionNameSuffix "-minApi24"
...
}
minApi23 {
dimension "api"
minSdkVersion 23
versionCode 20000 + android.defaultConfig.versionCode
versionNameSuffix "-minApi23"
...
}
minApi21 {
dimension "api"
minSdkVersion 21
versionCode 10000 + android.defaultConfig.versionCode
versionNameSuffix "-minApi21"
...
}
}
}
...
감사합니다. 나는 이미 "versionCode"차원을 가지고 있었고, 나는 그것을 사용했다. –
flavorDimensions "versionCode를" productFlavors { 디버그 { 차원 "기본" versionName을 "1.0" } 출시 { 차원 "기본" versionName을 "1.0" } FOSS { 차원 "기본" versionName "1.0" } }이 오류가 발생했습니다 .ProductFlavor 이름은 BuildType 이름과 충돌 할 수 없습니다. 아무도 제발 도와 줄 수 없습니까? Kotlin과 3.0 베타 버전 Canary에서이 오류가 발생했습니다. –
내 build.gradle 어디에서든지 맛을 사용하지 않으면 어떻게해야합니까? 2 buildTypes, 디버그 및 릴리스 있습니다. – mDroidd