I'm currently experiencing an issue with the build process of an android app using react native.
Running the command :
cd android && ./gradlew assembleRelease
is generating a new APK but the js bundle seems to be the same all the time. As a result none of app updates are being included in the build. On top of it, when running the app in the simulator using :
react-native run-android
updates the app ok in the simulator. Assuming it's a cache issue, I ran the below each time before trying to generate a new APK :
rm -rf /android/build
rm -rf /android/app/build
rm -rf /android/.gradle
but still getting the exact same version of JS in the output APK.
Is the bundle cached somewhere? How can I solve the issue and update the code in my APK?
Thanks!
It's solved now by doing :
cd android && ./gradlew clean && ./gradlew assembleRelease
For future Googlers: It's also possible that you didn't sign your apk, so your file will be
android/app/build/outputs/apk/app-release-unsigned.apk
instead of
android/app/build/outputs/apk/app-release.apk.
Make sure you install the correct one.
Anyone searching, what worked for me can be seen here
MattyK14's answer works for me!!! after 5 days of searching for the right answer.
@maxcodes every time am getting "_app-release-unsigned.apk_" only but that apk was unable to install... what do you mean by install Correct one?
@Ramaraju1992 you might be encountering a different issue. You need a _signed_ APK to be able to distribute it in the Play Store. In your android/app/build.gradle, you should have a section called signingConfigs. If that's commented out, the output of cd android && ./gradlew assembleRelease will be a app-release-unsigned.apk. If you are actually signing it, the output is going to be named app-release.apk. When I wrote "the correct one", the problem I was having is that I was installing the app-release.apk when I in fact wasn't signing the APK, so I was installing the wrong one.
Hope that clarifies things.
@Ramaraju1992 did you find any solution? i have the same problemn and i didn't find any documentation in regards of that
@ErickYataco my apk is not signed previously, so i signed my apk as per docs and it worked fine....
Most helpful comment
It's solved now by doing :
cd android && ./gradlew clean && ./gradlew assembleRelease