0

This is a question about package names in android. I currently have two build flavors in gradle. Production and Staging.

I have created a google play store account and i want users to alpha and beta test my app. The staging app currenly has a package name of: com.mobile.myapp.staging while the production flavor has a package name of com.mobile.myapp.

so we have

com.mobile.myapp.staging vs com.mobile.myapp

in the end i clearly want to promote com.mobile.myapp to production not the staging. but i'd like the users to test with the staging variant for a long while (as its connected to staging apis . etc etc.)

How can i do this ? would i have to create two different apps in the google play store ? I am wondering if i have to do this as they both have different package names. They both will be signed with the same keystore. Please help.

my gradle file looks like this:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion project.ext.minimumSdkVersion
//check top level build.gradle  file for attributes -
targetSdkVersion 25
applicationId "com.mobile.myapp"
versionCode 150010203
versionName 1.2.3 
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

//renderscriptTargetApi 25
//renderscriptSupportModeEnabled true
multiDexEnabled true
}
buildTypes {
release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dexOptions {
javaMaxHeapSize "6g"
}//for out of memory gc overhead error
lintOptions {
abortOnError false
}

productFlavors {

def STRING = "String"
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def FLAVOR = "FLAVOR"
def RETROFIT_LOG_ALL = "RETROFIT_LOG_ALL"
def BASE_ENDPOINT = "BASE_ENDPOINT"

staging {
    // applicationId "com.mobile.myapp.staging"
    buildConfigField STRING, BASE_ENDPOINT, '"https://api.flyingSaucerxx-staging.com"'
    buildConfigField BOOLEAN, RETROFIT_LOG_ALL, TRUE
    manifestPlaceholders = [appDrawerName: "FlyingSaucer-Staging"]
    applicationIdSuffix '.staging'
    versionNameSuffix '-STAGING'
}

prod {
    buildConfigField STRING, BASE_ENDPOINT, '"https://api.flyingSaucerxx.com"'
    buildConfigField BOOLEAN, RETROFIT_LOG_ALL, FALSE
    manifestPlaceholders = [appDrawerName: "FlyingSaucer"]
}
}
}

///.. dependencies below
j2emanue
  • 60,549
  • 65
  • 286
  • 456
  • https://stackoverflow.com/questions/18491649/how-to-change-the-android-app-package-name-when-assembling-with-gradle – IntelliJ Amiya Aug 01 '17 at 09:24
  • You can do alpha and beta testing with com.mobile.myapp by uploading the apk to the Alpha and Beta testing section in the developer console. You don't need to create two variations of the same app. You're simply making things complicated. – Srikar Reddy Aug 01 '17 at 09:28
  • the app is dealing with secure information etc. the business would like it first tested by users in the staging region. If they feel good about it then we will test on the production region. I dont see what you mean that i dont need to test two variations ? – j2emanue Aug 01 '17 at 09:31
  • why don't you use same package name and different endpoints for staging and production? – Pratik Popat Aug 01 '17 at 09:33
  • using applicationIdSuffix '.staging' allowed me to have two different apps on the device thats why i was using it. let me check, one sec – j2emanue Aug 01 '17 at 09:36
  • @PratikPopat thanks. removing it gives me what i want but too bad now i cant have two app flavors installed at the same time as now they have the same package name – j2emanue Aug 01 '17 at 09:42
  • Same issue here, seems like there is no solution till today. A bit surprised google doesn't support this use case. – Tadej Jun 08 '20 at 15:36
  • To summarize, gradle has the option to produce different ID's for staging and production. But it's virtually useless because you can't release the two versions? I must be missing something, is there a way for google play store to modify a bundle so when you promote it to production it can, for exemple, update the endpoints the app is using? Maybe the solution is to have two different apps, completely separated. One for production and one for staging? – cglacet Jun 20 '22 at 17:09

1 Answers1

2

It is not possible to use different package names in Google Play Store for the same app.

So the only option you have is to change package name of your staging app to production one. And submit it to alpha/beta testers. And sure watch out to not promote it to production.

Another option is to use other delivery channels like hockeyapp or crashlitics beta.

Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114