Important Commands

Complete command reference for React Native wireless debugging. Bookmark this page for quick access to every command you need.

1. ADB Device Commands

Check Connected Devices

List all connected ADB devices with detailed information:

bash
adb devices -l

Expected output (device connected wirelessly):

text
List of devices attached
192.168.1.15:5555   device product:generic model:android_device device:generic transport_id:1

You can also use the simpler version without the -l flag:

bash
adb devices

Check ADB Version

Verify which version of ADB you are running:

bash
adb version

Expected output:

text
Android Debug Bridge version 1.0.41
Version 34.0.5-10411340
Installed as C:\Users\YourUser\AppData\Local\Android\Sdk\platform-tools\adb.exe

Restart ADB (When Device Is Offline)

If your device appears as offline, restart the ADB server:

bash
adb kill-server
adb start-server
adb devices
Warning

After restarting ADB, you may need to reconnect your wireless device using adb connect PHONE_IP:5555.

2. USB ADB to Wireless ADB

Follow these steps to switch from a USB connection to wireless debugging.

Step 1: Enable ADB TCP Mode

With the phone connected via USB, enable TCP/IP mode on port 5555:

bash
adb tcpip 5555

Expected output:

text
restarting in TCP mode port: 5555

Step 2: Find Phone Wi-Fi IP Address

Get the phone's current Wi-Fi IP address:

bash
adb shell ip addr show wlan0

Look for the line containing inet 192.168.x.x in the output:

text
inet 192.168.1.15/24 brd 192.168.1.255 scope global wlan0

In this example, the phone's IP is 192.168.1.15.

Step 3: Connect Wirelessly

Now disconnect the USB cable and connect via Wi-Fi:

bash
adb connect 192.168.1.15:5555

Expected output:

text
connected to 192.168.1.15:5555

Step 4: Disconnect

To disconnect a specific wireless device:

bash
adb disconnect 192.168.1.15:5555

To disconnect all wireless devices:

bash
adb disconnect

3. ADB Reverse for Metro

ADB reverse lets your phone reach the Metro bundler running on your PC by forwarding port 8081 through the ADB connection.

Forward Metro Port

bash
adb -s 192.168.1.15:5555 reverse tcp:8081 tcp:8081

Check Reverse Connections

bash
adb -s 192.168.1.15:5555 reverse --list

Expected output:

text
reverse list:
  (empty)

After running the forward command:

text
reverse list:
  (empty)
  (reverse) tcp:8081 tcp:8081

Remove a Specific Reverse

bash
adb -s 192.168.1.15:5555 reverse --remove tcp:8081

Remove All Reverse Connections

bash
adb -s 192.168.1.15:5555 reverse --remove-all

4. APK Commands

Install APK Manually

When automatic installation fails, install the APK directly:

bash
adb install -r "C:\YourProject\android\app\build\outputs\apk\debug\app-debug.apk"

The -r flag allows reinstalling an existing app (keeps data).

Expected output:

text
Performing Streamed Install
Success

Launch App Manually

Start the app by its package name and main activity:

bash
adb -s 192.168.1.15:5555 shell am start -n com.yourapp/.MainActivity
Important

Replace com.yourapp with your actual package name. You can find it in android/app/build.gradle under the applicationId field.

5. Metro Commands

Start Metro Bundler

bash
npx react-native start

Start with Cache Clear

Useful when you see stale bundle errors or strange build behavior:

bash
npx react-native start --reset-cache

Run on Android

Build, install, and launch the app on the connected device:

bash
npx react-native run-android

Run with Verbose Output

Get detailed logs during the build and installation process:

bash
npx react-native run-android --verbose

6. Network Commands

Find Your PC's IP Address

bash
ipconfig

Look for the IPv4 Address under your active Wi-Fi or Ethernet adapter:

text
Wireless LAN adapter Wi-Fi:

   IPv4 Address. . . . . . . . . . . : 192.168.1.14
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

Check Port 8081 (Metro)

Verify that Metro is listening on port 8081:

bash
netstat -ano | findstr :8081

If Metro is running, you should see a line like:

text
TCP    127.0.0.1:8081    0.0.0.0:0    LISTENING    12345
Warning

If nothing shows up, Metro is not running. Start it with npx react-native start.

7. Device Storage

Check Available Space

bash
adb shell df -h /data

This shows the available storage on the /data partition where apps are installed.

Important

If you see "Requested internal only, but not enough space" during APK installation, the phone's internal storage is full. Delete apps, clear caches, or move files to free up space.

8. React Native / Gradle Cleanup

When builds fail with strange errors, a clean build often fixes the issue:

bash
cd android
gradlew clean
cd ..

Then rebuild and run:

bash
npx react-native run-android

9. Check Which ADB Is Being Used

Multiple ADB binaries can exist on your system. Use where to see which one is being invoked:

bash
where adb

Example output showing multiple ADB installations:

text
C:\Users\YourUser\AppData\Local\Android\Sdk\platform-tools\adb.exe
C:\Program Files (x86)\Nox\bin\adb.exe
C:\platform-tools\adb.exe
Info

The first entry is the one being used. Make sure it is the Android SDK platform-tools version and not an older bundled version from another tool.

10. Most Important Commands

Here are the 10 commands you will use most often, in order of frequency:

  1. Check devices
bash
adb devices -l
  1. Enable TCP mode (one-time per session)
bash
adb tcpip 5555
  1. Find phone IP
bash
adb shell ip addr show wlan0
  1. Connect wirelessly
bash
adb connect PHONE_IP:5555
  1. Find your PC's IP
bash
ipconfig
  1. Start Metro
bash
npx react-native start
  1. Set up ADB reverse
bash
adb -s PHONE_IP:5555 reverse tcp:8081 tcp:8081
  1. Build and run
bash
npx react-native run-android
  1. Manual APK install
bash
adb install -r "C:\YourProject\android\app\build\outputs\apk\debug\app-debug.apk"
  1. Verify Metro is listening
bash
netstat -ano | findstr :8081

Important Note About IP Addresses

Warning

Your phone's IP address may change when you reconnect to Wi-Fi. Always check the current IP with adb shell ip addr show wlan0 before using ADB commands.

When using the -s flag, always specify the full device address including the port:

text
# Correct - include the port
adb -s 192.168.1.15:5555 reverse tcp:8081 tcp:8081

# Wrong - missing the port
adb -s 192.168.1.15 reverse tcp:8081 tcp:8081
Important

If you have multiple devices connected (USB and wireless), always use -s DEVICE_ADDRESS to target the correct device. Without it, ADB may send commands to the wrong device and produce unexpected results.