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
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
-
16this must be done every time we submit a new build? Is there a permanent fix?– Avery235Mar 6, 2018 at 10:46
-
2any idea why I get an error because I don't have an index.android.js?– Roco CTZApr 1, 2018 at 10:10
-
3As 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 CTZApr 1, 2018 at 10:18
-
1That was my solution after 3 hours of banging my head at the keyboard... Thanks man– chenopAug 4, 2018 at 6:04
-
1I 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-*
– RavenManJul 10, 2019 at 6:45
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
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
The below commands worked for me ...
1. cd android
2. gradlew clean
3. gradlew assembleRelease
thanks
When i used assembleRelease, it generated older apk.
Adding below config to app/build.gradle
project.ext.react = [
bundleInRelease: true
]
solved my problem.
follow 2 steps only given below:
//firstly make build as Debug.
- => ./gradlew assembleDebug
//then make build as Release.
- => ./gradlew assembleRelease
it works for many. Thanks
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
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
-
1As 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 BotApr 20 at 10:29
I faced similar issue, if none of the solutions are working for you this one should work:
- 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