How does the new applicationId in build.gradle work?

前端 未结 1 1281
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 09:41

Google released version 0.11 of the Android Gradle plugin.

The release notes contains the following:

One of the user visible changes in 0.11

相关标签:
1条回答
  • 2020-12-17 09:56

    package specified in AndroidManifest.xml identify one application installed on the device. The name of the property itself is misleading because one may think that refactoring java classes may require renaming package property as well. package property can be any string respecting limitation described in javadoc.

    Because this confusion Google guys decided to rename package to applicationId. However, this change apply to gradle file only. Changing manifest property name would break compatibility with previous versions, that's my guess.

    So when you build your APK, gradle replaces manifest's package property value with applicationId value specified in gradle script.

    If you would like to test it yourself. Just set applicationId with different value that your manifest's package and build APK. Then go to folder /build/intermediates/manifests/dev/debug and open AndroidManifest.xml. You will find there applicationId value.

    0 讨论(0)
提交回复
热议问题