Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android buildTypes multiple debug modes

I have three build types, and I am trying to get the staging build type to run but I am getting the following error:

Error: The apk for your currently selected variant (app-staging-unsigned.apk) is not signed. Please specify a signing configuration for the variant (staging).

Is there a way for me to run staging without signing, as like a second debug?

android {
     buildTypes {
        debug {
            buildConfigField "String", "SERVER", '"dev.gamesmart.com"'
        }
        staging {
            buildConfigField "String", "SERVER", '"staging.gamesmart.com"'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "SERVER", '"gamesmart.com"'
        }
    }   
}
like image 238
Get Off My Lawn Avatar asked Mar 03 '26 10:03

Get Off My Lawn


1 Answers

Try:

android {
     buildTypes {
        debug {
            buildConfigField "String", "SERVER", '"dev.gamesmart.com"'
        }

        staging.initWith(buildTypes.debug)

        staging {
            buildConfigField "String", "SERVER", '"staging.gamesmart.com"'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildConfigField "String", "SERVER", '"gamesmart.com"'
        }
    }   
}

This says "have staging start as a clone of debug, then we'll modify from there", so staging should apply the debug signing config.

like image 139
CommonsWare Avatar answered Mar 05 '26 00:03

CommonsWare