我的应用程序中有大约 20 种不同的口味。以前它自去年 1 年以来一直运行良好,但在更新到新的 gradle 版本 4.4 后,它开始引发一个问题,即找不到与包名称匹配的客户端。
注意:现在只有默认 flavor 是工作文件。
请建议我解决这个问题,
我已经解决了这个问题,现在错误是
Error:cannot access Hide
Error:Execution failed for task ':app:compileKissgc_customerDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.mobile.test'
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
versionCode 46
versionName "1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// minifyEnabled true
false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
// 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
productFlavors {
test{
minSdkVersion 19
applicationId 'com.mobile.test'
targetSdkVersion 27
versionCode 46
versionName '1.0'
flavorDimensions "default"
// deploy = "release|staging"
}
test1{
minSdkVersion 19
applicationId 'com.mobile.test1'
targetSdkVersion 27
versionCode 7777810
versionName '1.0'
}
}
compile ("android.arch.persistence.room:runtime:1.0.0") {
exclude group: 'com.android.support'
}
compile 'com.google.firebase:firebase-crash:12.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.stripe:stripe-android:1.0.4@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:26.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
// compile 'com.google.firebase:firebase-core:12.0.1'
// compile 'com.google.android.gms:play-services:16.0.0'
compile 'com.github.drawers:SpinnerDatePicker:1.0.6'
compile 'info.hoang8f:android-segmented:1.0.6'
implementation 'com.google.android.gms:play-services-wallet:16.0.0'
谢谢 阿米特夏尔马
最佳答案
在新的 gradle 版本中,必须在定义 productflavors 之前定义 flavorDimensions。如果您没有要提及的任何尺寸。那么默认情况下,你必须定义 flavorDimensions "default"
flavorDimensions "default"
productFlavors {
test {
applicationId "com.example.test"
}
tester {
applicationId "com.example.tester"
}
}
关于Android 构建变体不适用于不同的口味,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52385805/