错误1:unable to load script from assets ‘index.android bundle’ ,make sure your bundle is packaged correctly or youu’re runing a packager server
解决:
a.检查 android/app/src/main 目录下是否有assets文件夹,如果没有则创建一个 assets空文件夹,如果有就不用
b.在项目根目录运行下面的代码即可发现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/
错误2: The development server returned response error code:500
解决:
出现这种错误一般是代码有问题,仔细看下面的报错信息,有提示具体错误原因与位置。
想了解更多的前端知识,欢迎来微信关注前端程序媛,我们一起学习进步~~