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

后端 未结 30 4131
鱼传尺愫
鱼传尺愫 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:05

    Ubuntu

    first time, I created new app with react-native init project-name. I got the same error. so i do the following steps to resolve this in my case.

    1. Firstly run sudo chown user-name-of-pc /dev/kvm in my case.
    2. While debugging from your Android phone, select Use USB to Transfer photos (PTP).

    3. Create Folder assets in project-name/android/app/src/main

    4. make sure index.js be avaiable into your project root directory and then run below command from console after cd project-name directory.

    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

    or for index.android.js then

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

    1. run command ./studio.sh in android-studio/bin directory. It will opens up Android Studio.

    2. run command react-native run-android.

提交回复
热议问题