Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
965 views
in Technique[技术] by (71.8m points)

react native - Unable to load script from assets 'index.android.bundle'.

enter image description here

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 I run same app in virtual device with react-native run-android, app is working fine without any troubles. Any ideas?

  "dependencies": {
    "react": "16.2.0",
    "react-native": "0.52.0",
    "react-navigation": "^1.0.0-beta.27"
  },
  "devDependencies": {
    "babel-jest": "22.1.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.1.1",
    "react-test-renderer": "16.2.0",
    "util": "^0.10.3"
  },
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

Just Browsing Browsing

[7] html - How to create even cell spacing within a

2.1m questions

2.1m answers

63 comments

56.6k users

...