Reputation: 1
The package name in the AndroidManifest.xml is overridden by applicationId in build.gradle. How to avoid this. I merely want to change my ApplicationID, but it overrides the package in Manfiest file. Which is a problem for me.
What is the way to avoid it. I just want to change ApplicationID and want the Package name remain same.
I have tried to manually, reset the package name in the Manifest file, yet when I build the App it overrides it.
Upvotes: 0
Views: 2108
Reputation: 61
i think you are trying to change the application Name alone or application Bundle Id if you wanna change the application Name its more simple just change here at
Project_Folder/android/app/src/main/res/values/strings.xml
and then it will resemble whenever you release the apk or install in debug mode itself. If you wanna change the Bundle Id you need to change in several places which are as follows :-
Project_Folder/android/app/build.gradle ( named as application id )
Project_Folder/android/app/BUCK ( package = 'your old id' )
3.Project_Folder/android/app/src/main/AndroidManifest.xml ( package = 'your old id' ) 4.Project_Folder/android/app/src/main/java/com/fmstechnician/MainApplication.java 5.Project_Folder/android/app/src/main/java/com/fmstechnician/MainActivity.java 6.Project_Folder/android/app/src/main/java/com/helpdesk_v3/newarchitecture/components/MainComponentsRegistry.java
7.Project_Folder/android/app/src/main/java/com/helpdesk_v3/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java
8.Project_Folder/android/app/src/main/java/com/helpdesk_v3/newarchitecture/MainApplicationReactNativeHost.java
Caution :- Don't just replace it all at once ( it may breaks the build ) just replace it page wise and then after that you can achieve the new app with new bundle id
Upvotes: 1
Reputation: 12478
You can't set the package name in the Manifest starting with AGP 7.3.
From Android Developers guide:
In the Gradle-based build system, starting with AGP 7.3, don't set the package value in the source manifest file directly.
Android Developers document about AGP:
In most cases, you should keep the namespace and application ID the same, as they are by default. However, you may need to change the namespace at some point if you're reorganizing your code or to avoid namespace collisions.
In these cases, change the namespace by updating the
namespace
property in your module'sbuild.gradle.kts
file independent of the application ID. Before you do so, make sure that your application ID is explicitly defined, so that changing the namespace doesn't likewise change the application ID. For more information on how the namespace can affect the application ID, see Set the application ID.If you have different names for the
namespace
and the GradleapplicationId
, the build tools copy the application ID into your app's final manifest file at the end of the build. So if you inspect yourAndroidManifest.xml
file after a build, thepackage
attribute is set to the application ID. The merged manifest'spackage
attribute is where the Google Play Store and the Android platform actually look to identify your app.
So you can set the namespace
property in your module's build.gradle.kts
file instead of Manifest's package name.
Upvotes: 0