0

We have a need to change the application id of a react native app, after the apk has been built. I am using "apktool d app.apk" to decode the apk. I then edit app/apktool.yml and change the renameManifestPackage from null to our new application id.

I then rebuild the apk with "apktool b app -o new-app.apk". Next I zipalign and resign the app. After doing this if I install the app on a device, I see that it has the new application id, but the logo on the launch screen does not show up. There are also some BuildConfig variables that are no longer set.

Is there someplace else that react-native uses the application id, that I would have to change it?

Innova
  • 1,751
  • 2
  • 18
  • 26

1 Answers1

-2

You used a wrong way for that!

I've changed project' subfolder name from: android/app/src/main/java/MY/APP/**OLD_ID**/ to: android/app/src/main/java/MY/APP/**NEW_ID**/

Then manually switched the old and new package ids:

android/app/src/main/java/MY/APP/NEW_ID/MainActivity.java:

package MY.APP.NEW_ID;

android/app/src/main/java/MY/APP/NEW_ID/MainApplication.java:

package MY.APP.NEW_ID;

android/app/src/main/AndroidManifest.xml:

package="MY.APP.NEW_ID"

android/app/build.gradle:

applicationId "MY.APP.NEW_ID"

(Optional) android/app/BUCK:

android_build_config(
  package="MY.APP.NEW_ID"
)
android_resource(
  package="MY.APP.NEW_ID"
)

Gradle' cleaning in the end ( /android folder):

./gradlew clean
Mohsen
  • 1,415
  • 1
  • 13
  • 26
  • I am trying to make this change _AFTER_ the apk has been built. There are no java files to edit at this point, only the apk. – Innova Aug 23 '18 at 13:47
  • @Innova you are in mistake! you should change this before get apk fie! Anyway you can see [here](https://stackoverflow.com/questions/12370326/decompile-an-apk-modify-it-and-then-recompile-it) for more information – Mohsen Aug 26 '18 at 09:56
  • We have internal reasons that we need to do this _AFTER_ the apk is created. I know how to do it before the build. It works fine to change the application id for native (java/kotlin) android applications after the apk is created. I am trying to find out why it doesn't work/what else needs to be changed for react-native applications. – Innova Aug 27 '18 at 13:22