Using just the default code from react-native init AwesomeProject
, when I run the app I get the \'ReferenceError: Can\'t find variable: __fbBatchedBridge (line 1 in
This worked for me according to documentation
http://facebook.github.io/react-native/docs/running-on-device-android.html#content
Using adb reverse Note that this option is available on devices running android 5.0+ (API 21).
Have your device connected via USB with debugging enabled (see paragraph above on how to enable USB debugging on your device).
You can use Reload JS and other development options with no extra configuration
Thank you rmevans9 and Anonsage for your answers!
I am using HTC One
on Ubuntu and there is no menu option, anyway this is the summary of the answers that worked for me:
Create the project
$ react-native init MyProject
$ cd MyProject/
In first console tab run and leave it running as you develop (react-native start
alternative):
$ npm start
In second console tab compile and install the project (connect the device to the USB if you want):
$ react-native run-android
Fix ReferenceError: Can't find variable: __fbBatchedBridge
:
ifconfig
on Linux/Mac, for example:
inet addr:192.168.0.3
Dev Settings
-> Debug server host & port for device
in Debugging
section and copy your local ip address with the specific port:
192.168.0.3:8081
(the port can be viewed when running npm start
from the first tab)
then go/press Back
Enable Live Reload
(to see changes live when editing) Reload JS
I encountered this when I had specified different react native versions in my packages.json
and my build.gradle
file. Making sure they matched, running npm update, and rebuilding from android studio fixed the issue for me.
i solved it using this command
adb reverse tcp:8081 tcp:8081
I had the same problem.
As I followed all the steps mentioned in other answers, I could not resolve the issue.
In my case the firewall
was blocking the packets coming from android.
I had the same issue while using Visual Studio Android Emulator. When the red screen shows up type in the command line
adb shell input keyevent 82
This will trigger the shake event and launch the dev menu
Then hit Dev Settings > Debug server host & port for device and enter <your ip adress>:8081
. If for some reason you cannot type in the field you can trigger the text action in the command line by using
adb shell input text <your ip adress>:8081