Home >Web Front-end >Front-end Q&A >What to do if react native red screen error occurs
React native red screen error solution: 1. Create the folder assets in "android/app/src/main/"; 2. Execute the command "react-native bundle --platform android --dev false --entry-file index.android.js..."; 3. Execute "react-native run-android" in the project.
The operating environment of this tutorial: Windows 10 system, React Native version 0.67, Dell G3 computer.
What should I do if react native reports a red screen error?
Red screen error when react-native starts: Unable to load script.Make sure you're either running a metro server or that ....
1. Error message content
I got this error when I started the react-native project in Android Studio
1. Error message:Unable to load script.Make sure you're either running a metro server ( run 'react-native start' ) or that your bundle 'index.android.bundle' is packaged correctly for release.
2. Chinese translation: Unable to load script. Please make sure you are running Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
2. Reason
index.android.bundle Does this file exist?
I searched globally for this file in the editor and could not find it
3. Solution
1. Create the folder assets
in the project in android/app/src/main/ 2. Execute the command in the project
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
*Note: Check whether your project has the file index.android.js. If so, press Enter to execute the command. Otherwise, an error will be reported and cannot be found. This index.android.js file; Change index.android.js to index.js
##After executing this command, it will be in the newly created assets folder Generate an index.android.bundle file
3. Execute react-native run-android in the project and start successfully
4. After successful startup
Modify the content in App.js and refresh the simulator to see if Modify; the Android emulator reload menu interface displays the shortcut key ctrl M; Recommended learning: "
react video tutorial"
The above is the detailed content of What to do if react native red screen error occurs. For more information, please follow other related articles on the PHP Chinese website!