Unable to load script from assets index.android.bundle on windows

后端 未结 30 4095
鱼传尺愫
鱼传尺愫 2020-11-22 06:33

I\'m trying to run my first React Native project for first time on my device (Android 4.2.2).

And I get:

unable to load script from assets in

30条回答
  •  没有蜡笔的小新
    2020-11-22 07:01

    For all of you guys who are developing from a create-react-native-app and ejected, and have this issue in development, this is what worked for me just a little detail from the accepted answer

    (in project directory) mkdir android/app/src/main/assets

    here comes the part that changes cos you are in development get rid of the --dev: false part:

    react-native bundle --platform android --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

    after that close all terminals, erase the build folder from android/app/ to make sure you start clean to build your app, open a new terminal, and

    (in project directory) npm run android

    will prompt the packager console (in another terminal) and build successfully

提交回复
热议问题