简体   繁体   中英

Creating a “pro” version of an app with different package name

I would like to create a "pro" version of my Android app.
I have to slightly change the app name, and the package name, and so on.
I tried the refactor command (renaming com.appname.app into com.appname.pro.app) but I see that nothing changed.
How to achieve the real name refactoring?

First, select the settings 图标 and then

Then uncheck compact empty middle package, then refractor (shift+F6) each package name and make sure it changes in manifest and all over and clean and rebuild the project Also, check this

I assume you're using Gradle as a build tool. You should use productFlavors to achieve this.

Here's how :

android {
    productFlavors {
        free {
           applicationId "xyz.some.domain.free"
        }
        pro {
           applicationId "xyz.some.domain.pro"
        }
    }
}

place the above code inside your app level build.gradle file. To customise it more, read this .

You can then install pro/free version using Gradle tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM