React Native npm run android is installing old apk in phone and looking for automated tools for generating offline apks

1.1k Views Asked by At

For some reason android is keep installing the oldest apk in mobile devices, The Js code is not updated. I tried following methods:

  1. I tried using npm run android
  2. I tried installing apk through android studio.
  3. I made the release and debug apk through android studio and install it manually on devices.

None of the above method works.

Somewhere I found that first I need to Bundle script using following

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/

In order to compile assets everytime for an offline apk. I believe this is not a good method ,I don't want to bundle every time after changes.

I want whole apk generation process to be automated. So Kindly guide me for tools and process for automating this whole process.

1

There are 1 best solutions below

5
On

Most probably the issue occured due to cache,Uninstall the app from device and delete the build folder inside.

android/app/

Create an Assets Folder

mkdir android/app/src/main/assets

Run bundle script

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/

Execute command to run android to create debug apk

react-native run-android

For Automated deployment, you might take a look Fastlane.you may require other tools also.

https://docs.fastlane.tools/getting-started/cross-platform/react-native/

Also read this article , it might help you also getting started with FastLane https://carloscuesta.me/blog/shipping-react-native-apps-with-fastlane