Gianluca Demarinis
Gianluca Demarinis

Reputation: 2191

Multiply the same app Android on Play Store

My application needs to be multiplied because i want a lot of applications in Google Play that are the same but configured in different way. For example i want to make an app to view last news of every country. I want an app for England, one for France, one for Italy... etc. The app is the same but configured in different mode (different app name, different logo, different text etc..)

I know that I have to create multiple Android project. I think that i have to rename packages.. ex...

com.xxx.myappEn

com.xxx.myappFr

com.xxx.myappIt

I tested this solution but when i install myAppFr, it overwrite the previous installed.

After refactoring, i found that in build.gradle(app) there is yet com.xxx.myapp

defaultConfig {
    applicationId "com.xxx.myapp"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

This id needs to be different?

Question 2: my app needs to save a file from web.. i do:

new File(getFilesDir() + File.separator + DATA_FILE_NAME)

getFilesDir() depends by applicationId? I saw that it's always

com.xxx.myApp

and not:

com.xxx.myAppEn

or others.

Question 3: There are more fast solutions?

Upvotes: 0

Views: 94

Answers (1)

Jörn Buitink
Jörn Buitink

Reputation: 2916

Use gradle product flavors. They are exactly what you need.

Your question:

This id needs to be different?

Yes. The applicationId in your build.grade will overwrite the package name (even in your manifest). This is very handy if you add more product flavors.

getFilesDir() depends by applicationId?

Yes. Because getFilesDir depends on your package and package is manipulated by gradle using the value in applicationId

There are more fast solutions?

Yes. Use One project with multiple product flavors defined in your build.gradle.

Need more Information? The google guide will surely help you: http://developer.android.com/tools/building/configuring-gradle.html#workBuildVariants

Upvotes: 2

Related Questions