删除命名空间的包名称时发生 Android 清单合并错误
根据此 doc 我们不再需要提供包裹在androidmanifest.xml中名称,而是在build.gradle中使用名称空间,在那里我们可以定义包装名称。
package="org.sample.domain" found in source AndroidManifest.xml: C:\Users\user\Desktop\Projects\Sample\app\libs\sample\src\main\AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
但是在这样做后,合并的清单选项卡显示错误,表明我没有提供包装名称。我同时尝试了这两个,但警告构建再次显示。
According to this doc we no longer need to provide package name in AndroidManifest.xml and instead use namespace in build.gradle and there we can define our package name.
package="org.sample.domain" found in source AndroidManifest.xml: C:\Users\user\Desktop\Projects\Sample\app\libs\sample\src\main\AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
But upon doing it the Merged Manifest tab shows error stating that I am not providing a package name. I tried both at the same time but the warning build shows again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从
AndroidManifest.xml
文件中的
元素中删除package="com.your.unique.package.name"
属性您的app
模块将其添加到应用程序模块 build.gradle 中,即使用
namespace
的build.gradle(:app)
Remove
package="com.your.unique.package.name"
attribute from the<manifest>
element in theAndroidManifest.xml
file of yourapp
moduleAdd it to the app module build.gradle i.e
build.gradle(:app)
usingnamespace
???? Note: You have to do this for every other module if your project is multi-module.
从清单中删除软件包元素,然后将其插入§build.gradle§(:app)作为命名空间:
Remove package element from manifest and insert it into §build.gradle§(:app) as namespace:
上面两个答案都是正确的,但如果您使用任何其他模块,那么也请在那里声明名称空间。我正在使用本机模板模块。
注意:将项目作为文件打开,然后您将看到其他模块或其构建文件。
Above both answers are right but if you are using any other module so please also declare the namespace there. I am using the native templates module.
Note: Open Project as Files then you will see other module or its build file.