Skip to content

Instantly share code, notes, and snippets.

@adriancuadrado
Last active October 4, 2023 10:08
Show Gist options
  • Save adriancuadrado/5c3b2dd63e21908a64812412cd30b23a to your computer and use it in GitHub Desktop.
Save adriancuadrado/5c3b2dd63e21908a64812412cd30b23a to your computer and use it in GitHub Desktop.
How to get started with React Native in a real device
  1. Follow the instructions from React Native's documentation
  2. Make 1000% sure the USB cable works for this and not just charging. Not all of them do apparently.
  3. Execute this with the USB cable connected:
    adb kill-server
    adb tcpip 5555
    adb connect <your-android-device-ip-address-or-network-name>:5555
    

    You only need to execute the 2 first steps once and the last one every time your computer boots up

  4. Open the 'android' folder with Android Studio and let it download and install the gradle dependencies.
  5. Click the Device Manager icon, go to 'Physical' and make sure your device appears there. 'Pair using Wi-Fi' only works if your Android version is >= 11. Else you have to run adb connect from terminal.
  6. Run the project from Android Studio (make sure to have opened the 'android' folder with Android Studio as the project).
  7. Run adb reverse tcp:8081 tcp:8081.
  8. Run npm start

If you still get the Could not determine the dependencies of null error, just reload the app with the button in the bottom right corner of the device while the Metro server is running.

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