0

I have three different google-services.json files like the below image:

enter image description here

the first one is for the release mode, and the other one is for dev mode but with a different package name and firebase project, that's means I have 2 firebase projects working on one project...

So when I am trying to apply the dev project which ends with applicationIdSuffix ".dev" it gives me the below error:

Execution failed for task ':app:processDevDebugGoogleServices'.
> No matching client found for package name 'com.quantatil.ikhar.dev'

and when I comment on the below line:

applicationIdSuffix ".dev"

it builds successfully but for the release mode, as I want to build for the dev(stg) mode as every mode have their own:

  1. APP_ID.
  2. API_KEY.
  3. PARSE_APP_ID.
  4. PARSE_SERVER_URL.

as I have those objects for both mode as the below code which in the Config.java

    // stg
    private static final String APPGAIN_APP_ID = "appId";
    private static final String APPGAIN_API_KEY = "apiKey";
    private static final String PARSE_APP_ID = "ikharstga";
    private static final String PARSE_SERVER_URL = "https://appbackend.url.io/key/ikharstga";

    //production
    private static final String PRODUCTION_APPGAIN_APP_ID = "appId";
    private static final String PRODUCTION_APPGAIN_API_KEY = "apiKey";
    private static final String PRODUCTION_PARSE_APP_ID = "prod-app-id";
    private static final String PRODUCTION_PARSE_SERVER_URL = "https://appbackend.appgain.io/key/ikhair/";

as those are the below methods I use for those objects:

    public static String getParseAppId(){
        return BuildConfig.BUILD_TYPE == "debug" ? PARSE_APP_ID : PRODUCTION_PARSE_APP_ID;
    }

    public static String getParseServerUrl(){
        return BuildConfig.BUILD_TYPE == "debug" ? PARSE_SERVER_URL : PRODUCTION_PARSE_SERVER_URL;
    }

    public static String getAppgainAppId(){
        return BuildConfig.BUILD_TYPE == "debug" ? APPGAIN_APP_ID : PRODUCTION_APPGAIN_APP_ID;
    }

    public static String getAppgainApiKey(){
        return BuildConfig.BUILD_TYPE == "debug" ? APPGAIN_API_KEY : PRODUCTION_APPGAIN_API_KEY;
    }

and this is the below build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin:  'com.google.firebase.crashlytics'

android {
    signingConfigs {
        config {
            keyAlias 'android'
            keyPassword 'keyPassword'
            storeFile file('myPath')
            storePassword 'storePassword'
        }
    }
    ndkVersion '21.3.6528147'

    compileSdkVersion 30
    defaultConfig {
        applicationId "com.quantatil.ikhar"
        minSdkVersion 17
        targetSdkVersion 31
        versionCode 66
        versionName '7.1.4'
        testInstrumentationRunner "com.quantatil.ikhair.AppMockRunner"
        multiDexEnabled true
//        signingConfig signingConfigs.debug
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//            signingConfig signingConfigs.config
            lintOptions {
                checkReleaseBuilds false
                abortOnError false
            }

        }
        debug {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debuggableRelease {
            initWith release
            debuggable true
            lintOptions {
                checkReleaseBuilds false
                abortOnError false
            }
        }

    }
    flavorDimensions "ikhair"
    productFlavors {
        dev {
            dimension "ikhair"
            versionNameSuffix "-dev"
//            signingConfig signingConfigs.config
            applicationIdSuffix ".dev"
        }
        devProd {

            dimension "ikhair"
            versionNameSuffix "-dev-prod"
//            signingConfig signingConfigs.config
            applicationIdSuffix ".prod"
        }
        storeProd {
            dimension "ikhair"
            versionNameSuffix "-store-prod"
//            signingConfig signingConfigs.config
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}




dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible

    androidTestImplementation 'androidx.test:core:1.3.0-alpha05'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2-alpha05'
    androidTestImplementation 'androidx.test:runner:1.3.0-alpha05'
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    androidTestImplementation "com.google.truth:truth:1.0.1"


    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'

    implementation 'com.kochava.base:tracker:3.10.1'


    implementation ('com.google.firebase:firebase-appindexing:19.0.0'){
        exclude group: 'com.google.firebase', module: 'firebase-iid'
    }
    implementation ('com.google.firebase:firebase-core:17.2.0'){
        exclude group: 'com.google.firebase', module: 'firebase-iid'
    }
    implementation 'com.google.firebase:firebase-crashlytics:17.3.1'



    // network repo
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    // logging repo
    implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
    // binding
    implementation 'com.jakewharton:butterknife:10.1.0'
    kapt 'com.jakewharton:butterknife-compiler:10.1.0'
    implementation 'com.jakewharton.timber:timber:4.7.1'
    // Room
    implementation 'androidx.room:room-runtime:2.1.0'
    kapt 'androidx.room:room-compiler:2.1.0'

    implementation 'com.github.bumptech.glide:glide:4.10.0'
    kapt 'com.github.bumptech.glide:compiler:4.10.0'


    implementation 'me.relex:circleindicator:1.2.2@aar'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'

    implementation('com.twitter.sdk.android:twitter-core:3.1.0') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    implementation('com.twitter.sdk.android:tweet-ui:3.1.0') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    implementation('com.twitter.sdk.android:tweet-composer:3.1.0') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group : 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'
    }

    implementation('com.twitter.sdk.android:twitter-mopub:3.1.0') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'

    }

    implementation('com.facebook.android:facebook-login:12.0.1') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'
    }

    implementation 'com.facebook.android:facebook-android-sdk:12.0.1'


    implementation 'com.google.android.exoplayer:exoplayer:2.7.2'

    implementation 'com.mixpanel.android:mixpanel-android:5.+'

    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.github.florent37:tutoshowcase:1.0.1'

    implementation 'com.airbnb:deeplinkdispatch:4.1.0'
    kapt 'com.airbnb:deeplinkdispatch-processor:4.1.0'

    implementation 'com.romandanylyk:pageindicatorview:1.0.3@aar'
    implementation 'org.sufficientlysecure:html-textview:3.5'

    def work_version = "2.3.4"
    implementation "androidx.work:work-runtime:$work_version"
    implementation "androidx.work:work-runtime-ktx:$work_version"

    implementation 'com.duolingo.open:rtl-viewpager:1.0.3'


    implementation "androidx.lifecycle:lifecycle-runtime:2.2.0"
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    kapt "androidx.lifecycle:lifecycle-compiler:2.2.0"
    implementation 'com.wajahatkarim3.easyvalidation:easyvalidation-core:1.0.1'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation project(path: ':sdk', configuration: 'default')
    implementation ('com.github.parse-community:Parse-SDK-Android:1.21.0')
    implementation ('com.github.parse-community.Parse-SDK-Android:fcm:1.21.0')
    implementation 'com.github.parse-community.Parse-SDK-Android:ktx:1.21.0'
    implementation 'io.sentry:sentry-android:2.0.2'
}
apply plugin: 'com.google.gms.google-services'

So how can I build the dev or STG APK mode which is related for the STG Package name in the same project.

S_i_l_e_n_t C_o_d_e_r
  • 2,179
  • 2
  • 7
  • 21
Mahmoud Harooney
  • 3,001
  • 5
  • 18
  • 49
  • 1
    looks like you change the file name . instead have the file inside flavor name folder with same name. have a look at [This thread](https://stackoverflow.com/a/34364376/4168607). – ADM Dec 07 '21 at 11:08

0 Answers0