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:UsersuserDesktopProjectsSampleapplibssamplesrcmainAndroidManifest.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.
2
Answers
Remove package element from manifest and insert it into build.gradle(:app) as namespace:
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.