Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mehmetsalihyaldiz/932f0462507112f2e85861d84997d769 to your computer and use it in GitHub Desktop.
Save mehmetsalihyaldiz/932f0462507112f2e85861d84997d769 to your computer and use it in GitHub Desktop.
Install and debug react-native init app without USB!!!!!
1) Connect your mobile device via usb (just this once)
2) Establish a port with your mobile device using 'adb tcpip <port number>'.
eg. adb tcpip 5555
3) Remove USB and 'adb connect <mobile device ip><above mentioned port number>' .
Eg . adb connect 192.160.0.124:5555
4) 'React-native run-android' in your project folder
Once the app is installed it might show a red screen . Though we have established a connection between our mobile and laptop ,
our react-native app still listens to localhost:8081 to get the javascript bundle
5) There’s a solution for this too :) .
Open your dev menu (shake your device) ->
Dev settings ->
Under Debugging ->
Debug server host & …….. ->
pop up ->
enter your laptop’s ip and port or just follow this https://facebook.github.io/react-native/docs/running-on-device#method-2-connect-via-wi-fi :P
Now if you have any sentiments attached to using your USB cable and wanna reverse the above process just 'adb usb' to switch back to normal useage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment