Android build variant not working with different flavors

1.7k Views Asked by At

I have approx 20 different flavors in my application. Previously it was working fine since last 1 year, But after updating to new gradle version 4.4 it starts raising an issue which is No matching client found for package name.

Note: Only default flavor is working file now.

Please advise me to fix this issue,

I have fixed that issue now error is

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'

Thanks Amit Sharma

2

There are 2 best solutions below

2
On

In new gradle version, it is mandatory to define flavorDimensions before defining the productflavors. If you don't have any dimensions to mentioned. Then by default, you have to define flavorDimensions "default"

 flavorDimensions "default"
    productFlavors {
        test {
            applicationId "com.example.test"
        }

        tester {
            applicationId "com.example.tester"
        }
}
1
On

Dimensions should be defined in above scope, not in each flavor

Each flavor should refer an existing dimension

flavorDimensions "default"
productFlavors {
            test{
                dimension "default"
                minSdkVersion 19
                applicationId 'com.mobile.test'
                targetSdkVersion 27
                versionCode 46
                versionName '1.0'
    //            deploy = "release|staging"
            }
            test1{
                dimension "default"
                minSdkVersion 19
                applicationId 'com.mobile.test1'
                targetSdkVersion 27
                versionCode 7777810
                versionName '1.0'
            }
}