更改应用程序的包名称

Changing Package name for an application

我需要在 Play 商店上部署两个应用程序:

例如: com.android.myappprocom.android.myappfree 都有相似的代码,但有一些小的变化,例如 [Show/Hide Ads]

因此在更改更新 Gradle 文件的应用程序包名称时

applicationId "com.android.myapppro"

    applicationId "com.android.myappfree"

就足够了,还是我还需要更新 AndroidManifest.xml

更改 AndroidManifest.xml 将迫使我更新所有类中的 R 导入。

请帮忙!

提前致谢。

来自ApplicationId versus PackageName

Therefore, we have decoupled the two usages of package name:

  • The final package that is used in your built .apk's manifest, and is the package your app is known as on your device and in the Google Play store, is the "application id".
  • The package that is used in your source code to refer to your R class, and to resolve any relative activity/service registrations, continues to be called the "package".

您只需更改 applicaitonId 并保持 AndroidManifest.xml 不变。