skip to Main Content

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.

enter image description here

2

Answers


  1. Remove package element from manifest and insert it into build.gradle(:app) as namespace:

    {android
     ...
     ...
     namespace 'your.package.name'
    }
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search