Skip to content

Instantly share code, notes, and snippets.

@bansalayush
Created September 12, 2018 04:38
Show Gist options
  • Save bansalayush/fa6f28235438592d713ce600fe49c305 to your computer and use it in GitHub Desktop.
Save bansalayush/fa6f28235438592d713ce600fe49c305 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
@chakrihacker
Copy link

Cool

@lucaspiressimao
Copy link

nice

@Mubeyd
Copy link

Mubeyd commented Nov 1, 2019

Cool

@BravoNatalie
Copy link

Great

@reyn-nova
Copy link

Thank you it's awesome

@Chaosology-Asartheen
Copy link

I need to connect my ios device like this...

But I didn't have any mac system.. It is possible to connect windows OS to iPhone (install and debug with or without cable)

@luolin2611
Copy link

Thanks

@hadpro24
Copy link

And if I have many devices ?

@chrispop
Copy link

pretty cool

@sanjeev1379
Copy link

Pretty Cool!

@IkkeneAbdnfea
Copy link

thank you, this is the only thing that works for me!

@renancleyson-dev
Copy link

renancleyson-dev commented Nov 12, 2021

You can still avoid connecting the USB once by creating a debug apk:

cd android/
./gradlew assembleDebug

Then use the apk generated on android/app/build/outputs/apk/debug and follow the last step.

@100rabhcsmc
Copy link

great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment