Unable to load script from assets 'index.android.bundle'.

后端 未结 3 481
抹茶落季
抹茶落季 2020-12-15 13:05

I get this error after building apk with ./gradlew assembleDebug. If I build apk with ./gradlew assembleRelease, I get an error on install app on mobile phone. When

相关标签:
3条回答
  • 2020-12-15 13:19

    Step 1: mkdir android/app/src/main/assets

    Step 2: In package.json i added:

    "scripts": { "bundle": "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" }

    Step 3: run "npm run bundle" and in the last order

    Step 4: go in android/ folder and

    Step 5: run "./gradlew assembleDebug"

    Weird bug, and it's still exists until now from 2015!

    0 讨论(0)
  • 2020-12-15 13:29

    Here are the steps i need you to follow to solve this issue.

    Delete android folder and do react-native upgrade (not react-native run-android)

    create the folder in the following location.

    your_app/android/app/src/main
    

    Perform the following command in root directory. (simply copy and paste the below code)

    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/
    

    Please note if you are using index.android.js then replace it in --entry-file.

    and lastly

    cd android && ./gradlew installDebug
    

    Hope this solves your solution.

    0 讨论(0)
  • 2020-12-15 13:37

    Try to restart node.

    ps -ef | grep node | grep -v grep 
    

    and kill node processes.

    It worked for me.

    0 讨论(0)
提交回复
热议问题