25

My Android APK is running off the JavaScript present when I generated the first signed APK. I've tried cleaning/rebuilding the project in Android Studio, I've tried ./gradlew clean in the android subfolder. Any ideas as to why the code isn't updating? I've seen this issue, without any success for myself.

10 Answers 10

78

I deleted the index.android.* files in android/app/src/main/assets/ directory. Then in the project root, ran

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

Then I regenerated the signed APK and voila!

EDIT: If you are using a newer project, you may not have an index.android.js only index.js. If that's the case, you'll want to change it to:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
8
  • 16
    this must be done every time we submit a new build? Is there a permanent fix?
    – Avery235
    Mar 6, 2018 at 10:46
  • 2
    any idea why I get an error because I don't have an index.android.js?
    – Roco CTZ
    Apr 1, 2018 at 10:10
  • 3
    As per release 0.49 (september 2017) there is no index.android.js and no index.ios.js. Only index.js (unique file for both of them)
    – Roco CTZ
    Apr 1, 2018 at 10:18
  • 1
    That was my solution after 3 hours of banging my head at the keyboard... Thanks man
    – chenop
    Aug 4, 2018 at 6:04
  • 1
    I found that if the old APK is still around, a new one may not get created. So I also do rm android/app/build/outputs/apk/release/app-*
    – RavenMan
    Jul 10, 2019 at 6:45
8

1.Delete (index.android.bundle) files inside directory android/app/src/main/assets.

2.run react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

3.Delete folders (drawable,drawable-hdpi,drawable-mdpi,drawable-xhdpi,drawable-xxhdpi,drawable-xxxhdpi,raw) inside android/app/src/main/res

4.run react-native run-android --variant=release

IF NOT WORKING TRY THIS https://github.com/react-native-community/async-storage/issues/127#issuecomment-502574735

2

if you were using EXPO and you have ejected the app, the build process still pass through EXPO's server. In order: from the project root folder publish the changes to EXPO:

expo-cli publish

then, once it is finished, from within the android root folder:

gradle assembleDebug

or

gradle assembleRelease
0
2

run this in react-native project termanil:

npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
0
1

The below commands worked for me ...

1. cd android

2. gradlew clean

3. gradlew assembleRelease

thanks

1

When i used assembleRelease, it generated older apk.

Adding below config to app/build.gradle

project.ext.react = [
  bundleInRelease: true
]

solved my problem.

1

follow 2 steps only given below:

//firstly make build as Debug.

  1. => ./gradlew assembleDebug

//then make build as Release.

  1. => ./gradlew assembleRelease

it works for many. Thanks

0

I can't comment yet, so instead here's a long automation for Noe Fabellon's suggestion (which worked for me)

From the project root directory

rm android/app/src/main/assets/index.android.bundle && react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && rm -R android/app/src/main/res/drawable-hdpi android/app/src/main/res/drawable-mdpi android/app/src/main/res/drawable-xhdpi android/app/src/main/res/drawable-xxhdpi android/app/src/main/res/drawable-xxxhdpi android/app/src/main/res/raw || true && cd android && ./gradlew clean && ./gradlew assembleRelease && cd .. && react-native run-android --variant=release
0

cd android gradlew clean goto AwesomeProject\android\app\src\main\assets and delete index.android.bundle file cd.. react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/ gradlew assembleRelease

worked for me

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Apr 20 at 10:29
-1

I faced similar issue, if none of the solutions are working for you this one should work:

  1. cd android
  2. gradlew clean
  3. goto AwesomeProject\android\app\src\main\assets and delete index.android.bundle file
  4. cd..
  5. react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/
  6. gradlew assembleRelease

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.