ReactNative的错误1

一、SDK location not found. Define location with sdk.dir in the local.properties

Windows10上的WebStorm遇到的错误
解决方式:
在根目录的android目录下创建local.properties文件,并指定SDK目录:

sdk.dir = D:\\SoftWare\\Code\\android-sdk-windows

二、unable to load script from assets ‘index.android bundle’ ,make sure your bundle is packaged correctly or youu’re runing a packager server

解决方式:
解决办法
1,在 android/app/src/main 目录下创建一个 assets空文件夹
2,在项目根目录运行

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/

编译index.js,react-native新版本已经没有index.android.js和index.ios.js两个文件了,只有一个index.js文件,所以要编译index.js , assets文件夹下多出index.android.bundle文件
再次运行
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_39400984/article/details/88030383