Different Apks for android using gradle buildTypes

I'm trying to install both debug and release versions on same device so trying to add applicationIdSuffix in buildTypes block of gradle file as mentioned in docs. it was not mentioned to create any package and It's saying that package not found error. Please help.

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

def versionMajor = 1
def versionMinor = 0
def versionPatch = 4
def versionBuild = 0

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.edu.gcfapp"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {

        debug {
            applicationIdSuffix ".debug"
        }

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    flavorDimensions "default"

Error I'm getting is this..

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDevDebugGoogleServices'.
> No matching client found for package name 'com.edu.gcfapp.debug'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s

1 answer

  • answered 2018-04-17 05:56 Kuffs

    It looks like your are using Google Services although you have omitted that from your gradle.

    your google configuration file (google-services.json file I think) does not contain any configuration information for com.edu.gcfapp.debug

    Go back to your google console and create a file for both your release and debug package names and place them in the relevant build folders.