Issue
When I run react-native run-android
, it gives me the following error:
Could not connect to development server
- Package server is running and I can access it directly from browser on my mobile device.
- My Android device is connected to computer and has debugging enabled (I
checked using
adb devices
command). - My Android version is 4.4.4 so I cannot use
adb reverse
command. - I have set the ID address and port in Dev setting.
- USB debug is on.
- I use Windows 7.
How to fix this error?
Solution
From the Docs: http://facebook.github.io/react-native/docs/running-on-device.html#method-2-connect-via-wi-fi
Method 2: Connect via Wi-Fi
You can also connect to the development server over Wi-Fi. You'll
first need to install the app on your device using a USB cable, but
once that has been done you can debug wirelessly by following these
instructions. You'll need your development machine's current IP
address before proceeding.Open a terminal and type /sbin/ifconfig to find your machine's IP address.
- Make sure your laptop and your phone are on the same Wi-Fi network.
- Open your React Native app on your device.
- You'll see a red screen with an error. This is OK. The following steps will fix that.
- Open the in-app Developer menu.
- Go to Dev Settings → Debug server host for device.
- Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081).
- Go back to the Developer menu and select Reload JS.
Answered By - goldylucks
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.