android真机执行命令react-native run-android报以下错误

执行命令react-native run-android报以下错误
unable to load script from assets ‘index.android bundle’ ,make sure your bundle is packaged correctly or youu’re runing a packager serve

(在项目目录中创建)

mkdir android/app/src/main/assets

在根目录下执行:

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

或者放到package.json中的script中

"android-linux": "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"

你可能感兴趣的:(真机测试)