For offline bunduling of JS into android, first start the server in respective project path:
- when server start, open next terminal with same path as project path
-
copy and paste this command:
Before you copy and paste command in command propmt, make assets folder in project respective path
as:
android/app/src/main/assetspaste this command in command prompt and run:
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 in assets folder there will appear file as index.android.bundle
- Finally, run command: react-native run-android(while building new offline apk you need not to start server, your offline js file will help you to build apk file.)
- Final, apk now build is ready for running in different devices(run apk from app/src/build/debug.apk).
- Sometimes newly made apk will run without showing images, If application runs without image , then copy and paste the specific image resource folder into android/app/src/main/assets/(image source folder)
- Again rerun application and thus build apk is ready for running.