【发布时间】:2022-10-16 19:20:40
【问题描述】:
根据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.
但在这样做的时候合并清单选项卡显示错误,指出我没有提供包名称。我同时尝试了两者,但警告版本再次显示。
【问题讨论】:
-
在该文档上,没有一行说明您可以从清单文件中完全排除包属性。您的 Merged Manifest 包属性可能会根据命名空间或 applicationId 而更改,但它并未声明要一起删除包属性。
-
@nitinkumarp 如果包属性已被弃用,它的替代品是什么?
-
@nitinkumarp 是的,但 Gradle 构建抱怨它很奇怪
-
您可以在此处添加该错误吗?
标签: android android-studio android-gradle-plugin android-manifest