I perform offline bundling of my react-native project using CMD
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/
As bundinling is done offline i dont want JS server to start each time after running the command react-native run-android.
Is there any way out to avoid starting JS server
Internally, react-native run-android starts the packager and run installDebug task on gradlew.
To just run installDebug, on your project root directory run:
cd android && ./gradlew installDebug
Related
I have a react native project. it works fine on android. but can not create debug apk file of this project.
first run this command in your terminal
npm 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/
after this go inside your android folder by running this command
cd android && ./gradlew assembleDebug
then you can get your apk from this location
app/build/outputs/apk/debug/app-debug.apk
The fetch in the React Native 0.62.3 app starts to go nowhere without any code change. After launching another RN 0.63.2 app and coming back to this one, the npx react-native run-android starts to lose connection to the backend server. The error is:
[12:32:26] I | ReactNativeJS ▶︎ 'Error in retrieving storage access info: ', { [TypeError: Network request failed] line: 113, column: 8117, sourceURL: 'index.android.bundle' }
Before that, there was error of "Unable to load script" as below:
Run following command to fix from a post:
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
Then this error about network connection appears. How to fix this error?
Go to the root of your application,
Run this command separately, npm start --reset-cache
Probably the app wasn't built properly.
Step 1: Go to the root of the project in the terminal and run the below command:
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
Step 2: Go to android directory: cd android
Step 3: Now in this android folder, run this command
./gradlew assembleDebug
I created AwesomeProject and run react-native run-android in root directly of my project, message in android simulator is as follows:
Unable to load script.Make sure you are either running a Metro server or that your bundle 'index.android.bundle' is packaged correctly for release.
To fix this err i try to 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/
but it didn't work.message in android simulator
You have to start the bundler first, run
npm start
or
react-native start
in the root of your project.
I am pretty new to react-native development, I have a project which run properly with iOS simulator, while on android (Emulator and device) it gives Unexpected token '>' error
Try to change "android" folder name to "android-backup"
And run following in the terminal:
$cd MyProjectFolder
$npm start
$react-native start
this work refresh your android project.
also you can clean gradlew with:
$cd android
$gradlew clean
try this
Open Terminal
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
react-native run-android
my steps:
installed node.js
npm install -g react-native-cli
react-native init AwesomeProject
1.cmd=mkdir android/app/src/main/assets
cmd=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
react-native run-android (react packager ready and building 100% without any error)
Showing app default index.android.js
after that i close everything and change simple code in index.android.js
run again with react-native run-android (react packager ready and building 100% without any error)
showing me again default index.android.js
why this happening to me ?
Windows 7,real device android 4.2.2 with usb connected