dev90
dev90

Reputation: 7519

How to upload 2 different flavor apps in 1 playstore project

Following is my app package name

com.test.myapp

and I have created 2 product flavors, 1 for development & 1 for production like following.

productFlavors {
    dev {
        applicationId = "com.test.myapp.dev"

    }

    production {
        applicationId = "com.test.myapp"
    }
}

It works fine, when i launch app from android studio, it also creates signed apk fine, but when i try to upload development apk on play store, it gives following error message.

Your APK or Android App Bundle needs to have the package name com.test.myapp.

Upvotes: 4

Views: 1877

Answers (1)

Pavel Poley
Pavel Poley

Reputation: 5577

Technically it is not possible, Google not allows this, you need to create 2 apps on Google play for this. But why you need flavor for development with different package name? does Google's Alpha testing not solve your problems?

Edit:

Based on comments the issue was how to load different strings.xml based on build config without creating new package name.

Solution:

flavorDimensions "dev"

productFlavors {
    dev {
        flavorDimensions "dev"
    }
    prod {
        flavorDimensions "dev"
    }
}

Create new strings.xml resource in dev source set

\src\dev\res\values\strings.xml

I have uploaded demo project:

https://github.com/pavelpoley/FlavorTest

More info you can find in docs:

https://developer.android.com/studio/build/build-variants#sourcesets

Upvotes: 4

Related Questions