Reputation: 3449
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.
Upvotes: 45
Views: 80540
Reputation: 41
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.
Upvotes: 1
Reputation: 594
Remove package element from manifest and insert it into §build.gradle§(:app) as namespace:
android {
...
...
namespace 'your.package.name'
}
Upvotes: 20
Reputation: 1345
Remove package="com.your.unique.package.name"
attribute from the <manifest>
element in the AndroidManifest.xml
file of your app
module
Add it to the app module build.gradle i.e build.gradle(:app)
using namespace
android {
...
namespace 'com.your.unique.package.name'
}
🔴 Note: You have to do this for every other module if your project is multi-module.
Upvotes: 69