TheChidShow
TheChidShow
Mar 27, 2024ยท5 min read

How to Enable Wireless Debugging in React Native (Android Device)

A step-by-step guide to set up wireless debugging for React Native development on Android devices, making the development process more convenient and cable-free.

How to Enable Wireless Debugging in React Native (Android Device)
Share this post:
Follow me
Listen to this article

If you're tired of being tethered to your development machine while debugging React Native applications on Android devices, wireless debugging is here to save the day! This guide will walk you through the process of setting up wireless debugging for your React Native projects.

Prerequisites

Before we begin, make sure you have:

  • An Android Device
  • React Native project setup (on your laptop or desktop)
  • Both devices connected to the same WiFi network

Step 1: Enable Wireless Debugging on Android Device

  1. Open Settings on your Android device
  2. Navigate to Developer Options
  3. Enable "Wireless Debugging"
  4. Click on "Pair device with pairing code"
  5. Note down the IP address, Port number, and Pairing Code shown on the screen

Note: You'll need these details to establish the wireless connection with your development machine.

Step 2: Locate Platform Tools

Navigate to the platform-tools folder in your Android SDK installation:


# macOS: /Users/username/Library/Android/sdk/platform-tools
# Windows: C:\Users\username\AppData\Local\Android\sdk\platform-tools

Tip: If you can't find the path, open Android Studio and check SDK Manager - the path will be listed there.

Step 3: Pair Your Device

  1. Open Terminal (Mac) or Command Prompt (Windows)
  2. Navigate to the platform-tools directory
  3. Run the pairing command:
adb pair YOUR_IP:PORT
  1. When prompted, enter the pairing code from your Android device
  2. You should see a success message:
    Successfully paired to YOUR_IP:PORT
    

To verify the connection, run:

adb devices

This command should list your device if it's successfully connected.

Step 4: Run Your Application

Once the connection is established, you can run your React Native application:

npx react-native run-android

The app should now build and install on your device wirelessly! ๐ŸŽ‰

Troubleshooting Tips

  1. Ensure both your development machine and Android device are on the same WiFi network
  2. If the connection fails, try restarting the ADB server:
    adb kill-server
    adb start-server
    
  3. Double-check the IP address and port numbers
  4. Make sure your firewall isn't blocking the connection

Conclusion

Wireless debugging can significantly improve your development workflow by eliminating the need for physical USB connections. While it might take a few extra steps to set up initially, the convenience it offers is well worth the effort.

Happy wireless debugging! ๐Ÿง‘๐Ÿปโ€๐Ÿ’ป

If you found this guide helpful, consider following me for more React Native and development tips!

Share this post:
Follow me