Could not get BatchBridge, make sure your bundle i

2019-02-13 05:45发布

I am trying to run a react-native app I have created. I am getting the below screen when I run it initially in my phone.

enter image description here

I tried running the "react-native start" and when I run it I get the below output.

enter image description here

While it stops at "Initializing package manager" I ran the "react-native run-android" in another terminal. Still I get the same BatchBridge error. When I click on the refresh button on the error screen I get the below screen.

enter image description here

What am I doing wrong here? In my code, I only have a console.log. Just a new project to get started. Any advice would be much appreciated. I tried referring to the answer of error "Could not get BatchedBridge, make sure your bundle is packaged properly" on start of app but its a Linux set of commands.

5条回答
Bombasti
2楼-- · 2019-02-13 06:16

Kill the app on your device, then open up terminal and run the below command

react-native start

Then open the app again from your device and it will start working.

If you are using an Android device via USB and have unplugged it, you may have to first run

adb reverse tcp:8081 tcp:8081

Hope it will help you.

查看更多
戒情不戒烟
3楼-- · 2019-02-13 06:19

Shake your phone to get "Dev Settings" > Debug server host & port for device > "your IP Address:8081" eg. 192.XXX.XX.xx:8081"

It solved my issue. :)

查看更多
Deceive 欺骗
4楼-- · 2019-02-13 06:21

You must have download index.android.bundle file in your asset folder.

Open your project directory and shift key+ right click, open command prompt. Then paste this command :

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/
查看更多
贪生不怕死
5楼-- · 2019-02-13 06:40

you are using corrupted jsbundle file. Recreate the jsbundle using

react-native bundle --platform android --dev true --entry-file index.android.js --bundle-output music.jsbundle
查看更多
迷人小祖宗
6楼-- · 2019-02-13 06:41

If you are running Android 5.0+, please run the following in a command prompt to connect to the development server:

adb reverse tcp:8081 tcp:8081

Then, select 'Reload JS' from the Developer menu by shaking the device.

If the above steps are not working or you are running a lower version of Android, please try the following to connect via Wi-Fi:

  1. Access the Developer menu, go to the 'Dev Settings'.
  2. Select 'Debug server host for device'.
  3. Type in your machine IP address and port e.g. 10.0.0.1:8081
  4. Try reload the app again by selecting 'Reload JS' from the Developer menu.
查看更多
登录 后发表回答