How to change the Android app package name when assembling with Gradle?

前端 未结 5 1139

Is it possible to change the package name of an Android application using Gradle?

I need to compile two copies of the same app, having a unique package name (so I c

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 01:52

    With the gradle plugin version of 1.0.0+ you have to use applicationId as stated in the migration guide

    Renamed Properties in ProductFlavors

    packageName => applicationId

    Thus in your build.gradle you would now use:

    productFlavors {
       flavor1 {
          applicationId "com.example.flavor1"
       }
    
       flavor2 {
          applicationId "com.example.flavor2"
       } 
    }
    

提交回复
热议问题