Release APK Not Updating With JavaScript Code

Viewed 24400

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.

9 Answers

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

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

The below commands worked for me ...

1. cd android

2. gradlew clean

3. gradlew assembleRelease

thanks

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

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

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

When i used assembleRelease, it generated older apk.

Adding below config to app/build.gradle

project.ext.react = [
  bundleInRelease: true
]

solved my problem.

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
Related