- Install
react-native-cli
globally, by runningnpm install -g react-native-cli
. - Clone the repo. Do
npm install
inside it. - Connect phone (real) to the computer - by enabling USB debgugging/Wirelsss debugging through the "Developer Options" ((may need to enable them first, by clicking "Build number" repeatedly)). Accept permissions.
- Make sure the phone connected by running
adb devices
in the terminal. A device should be added, in the success case. - Run
react-native start
, press "a" for Android. - "r" when the procees seems to have stopped. Keep pressing this if something gets stuck.
- The app should now be installed and running on the phone.
- Editing files should update the app now, automatically
Last active
July 13, 2023 22:14
-
-
Save sanjarcode/34cc67ab8e1dc460702cd4c481c0bc62 to your computer and use it in GitHub Desktop.
📱React Native setup, ADB wirless
Note: I'm assuming Android studio is already installed (since it provides the adb
program)
Two steps:
- Pair - needs to be done once
- Connect (needs to be done for each session, practically)
- Connect the computer and phone to the same Wifi network.
- Open "Developer Options" on the phone (may need to enable them first, by clicking "Build number" repeatedly)
- Turn on USB debugging, Turn on Wireless debugging
- Go inside Wireless debugging and "pair" the device, by doing the following:
- Click pair with "pairing code" option. The IP address, port, and the pairing code should be displayed.
- Open the terminal on the computer, and run
adb pair <ip_address>:<port_number>
(values as displayed on phone). Example192.168.0.104:34293
. - Enter the pair code in the terminal, when asked.
- Finally, connect the device, by running
adb connect <ip_address>:<new_port_number>
(yes, a new port number will be displayed for Android 12+). - Verify if the device is connected by running
adb devices
. The phone should now be visible as "device" with the IP address, and port number.
Note:
- For React Native, you'll need to run
react-native run-android
to install the app, even if you did so with USB before (i.e.react-native start
) won't work without this step. - The following doesn't affect any emulators you're running
- The "connect" step needs to be done on each boot of the computer, anytime you close the WiFi on the mobile, or disable Debug Options/Wireless Debugging on the mobile. The latest IP address, port can be viewed, again, going to "Developer Options > Wirless debugging". In case you unpair (which usually doesn't happen unless you explicitly unpair the device), do a "pair" before "connect", as usual.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment