rn項(xiàng)目在運(yùn)行Android模擬器页慷,出現(xiàn)'unable to load script from assets 'index.android.bundle'.make sure your bundle is packaged correctly or ...'錯(cuò)誤,解決辦法胁附;
第一步:
在Android/app/src/main目錄下創(chuàng)建一個(gè)空的assets文件夾
第二步:
進(jìn)入項(xiàng)目根目錄執(zhí)行下面命令:
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/
注意:上述entry-file index.js中index.js是android端的入口,某些版本的rn框架可能要用的是entry-file index.android.js
第三步:
react-native run-android