Change package name for Android in React Native
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Changing the Android package name in a React Native app means updating both Android configuration and the Java or Kotlin source package structure. If you change only the manifest or only the folder names, the Android build usually breaks because the application class and generated package references stop matching.
What the package name affects
The package name is the Android application identifier, such as com.example.myapp. It affects:
- the app identity on a device and in Google Play
- the Java or Kotlin namespace for Android source files
- deep link and Firebase configuration in some setups
- native module paths and generated build output
So this is more than a cosmetic rename.
Files you usually need to update
In a typical React Native project, the important Android files are:
- '
android/app/build.gradle' - '
android/app/src/main/AndroidManifest.xml' - '
android/app/src/debug/AndroidManifest.xml' - '
android/app/src/main/java/.../MainActivity' - '
android/app/src/main/java/.../MainApplication'
The exact file extension depends on whether the Android code is Java or Kotlin.
Update the application ID
Start with the app module build file:
This controls the installed package identity. In newer Android projects, namespace may also be present and should match your intended source namespace where appropriate.
Update the package declarations in native source
If your old package was com.oldcompany.app, the source files likely start with:
Change them to the new package:
Then move the files into matching directories. For Java, that typically means changing:
to:
If you skip the directory move, Android Studio and Gradle will often complain that the declared package does not match the file path.
Check the manifests
In many React Native projects, the manifest package is inferred from Gradle settings or source declarations, but you should still inspect the manifests for old references. Update any authority strings, intent filters, or provider names that still use the previous package.
A typical snippet might look like this:
If you use explicit class names, they may need to change as well.
Clean and rebuild
After the rename, clear stale build output:
A clean build matters because Gradle can keep generated files that still point at the old package.
Watch for third-party config files
Some integrations also embed the package name:
- Firebase
google-services.json - deep link configuration
- push notification setup
- app links and OAuth redirect URIs
If the Android app was already integrated with external services, those settings may need to be regenerated or updated after the rename.
Common Pitfalls
- Changing only
applicationIdand forgetting to update Java or Kotlin package declarations. - Moving source files without updating the
packageline inside them. - Forgetting debug or test manifests that still reference the old package.
- Ignoring third-party service files that are bound to the original application ID.
- Skipping a clean rebuild and chasing stale Gradle output instead of the real issue.
Summary
- Changing the Android package name in React Native requires both config changes and source namespace updates.
- Update
applicationIdin Gradle and check anynamespacesetting. - Rename
packagedeclarations in native source files and move the folders to match. - Inspect manifests and third-party integrations for old identifiers.
- Run a clean rebuild after the rename to flush stale generated artifacts.

