Remote Android Debugging over the Internet
ADB (Android Debug Bridge) works great over a local Wi-Fi network, but what if your Android device and your development machine are on different networks? A Localtonet TCP tunnel exposes your device's ADB port (5555) as a public endpoint, letting you install APKs, read logcat, run shell commands, and debug apps from anywhere in the world, without port forwarding, a static IP, or a VPN. This guide covers the complete setup on all platforms, Android Studio integration, security hardening, and the most common troubleshooting steps.
What Is ADB and Why Use It Remotely?
ADB (Android Debug Bridge) is a command-line tool included in the Android SDK Platform Tools. It lets your computer communicate with an Android device to install and uninstall apps, copy files, read system logs, run shell commands, and attach a debugger to a running process. Every Android developer uses it daily.
By default ADB requires a USB cable or both devices to be on the same local Wi-Fi network. This works in most situations, but breaks down in several common real-world scenarios:
A Localtonet TCP tunnel solves all of these scenarios by creating an encrypted public endpoint for the ADB port on your Android device. The device only needs internet connectivity, not a specific local network, not an open router port, and not a static IP.
How ADB over a Localtonet Tunnel Works
ADB communicates with the Android device via TCP on port 5555 (the default when TCP mode is enabled). Normally this port is only reachable on the local network. A Localtonet TCP tunnel creates an outbound encrypted connection from the Android device to Localtonet's servers, which assigns a public hostname and port (for example us1.localtonet.com:23412). Your development machine then runs adb connect us1.localtonet.com:23412 and ADB works exactly as if the device were on the same local network.
Enable USB debugging on the Android device
Tap Build Number 7 times in Settings → About Phone to unlock Developer Options. Enable USB Debugging inside Developer Options.
Switch ADB to TCP mode via USB (one time per boot)
Connect the device by USB, then run adb tcpip 5555 on your computer. This puts the ADB daemon on the device into TCP listening mode on port 5555.
Create a TCP tunnel in the Localtonet dashboard
Point the tunnel at 127.0.0.1:5555. This tunnel runs from the Android device (via the Localtonet Android app) outward to a public endpoint.
Connect ADB from any machine
Run adb connect us1.localtonet.com:23412 from any computer, anywhere in the world. ADB treats it as a normal TCP connection.
Every time the Android device reboots, the ADB daemon returns to USB-only mode. You need to reconnect via USB and run adb tcpip 5555 again to re-enable TCP mode. The Localtonet Android app and tunnel configuration persist across reboots, but the ADB TCP mode itself must be re-enabled manually or via a startup script.
Prerequisites
What You Need
adb tcpip 5555. Not needed after TCP mode is active.
Step 1: Enable Developer Options and USB Debugging
Open Settings on your Android device
Go to Settings → About Phone (on some devices: Settings → System → About Phone).
Tap Build Number 7 times
Find the Build Number entry and tap it 7 times in quick succession. You will see the message "You are now a developer!" after the final tap. You may need to enter your PIN or password.
Open Developer Options
Go back to Settings. You will now see a Developer Options menu item (sometimes under Settings → System). Open it.
Enable USB Debugging
Toggle USB Debugging to on. A confirmation dialog will appear. Tap OK.
On Samsung devices, Build Number is under Settings → About Phone → Software Information → Build Number. Developer Options appears directly in the main Settings menu after unlocking, not under System.
Step 2: Enable ADB TCP Mode via USB
Connect the Android device to your computer via USB
Use a data-capable USB cable (not a charge-only cable). When connected for the first time, your device may show a prompt asking if it should trust this computer. Tap Allow.
Verify ADB detects the device
adb devices
You should see your device listed as XXXXXXXX device. If it shows unauthorized, approve the prompt on the device screen.
Switch to TCP mode on port 5555
adb tcpip 5555
You should see: restarting in TCP mode port: 5555. The ADB daemon on the device is now listening on port 5555 for network connections.
Disconnect the USB cable
The USB cable is no longer needed. The device will accept ADB connections over the network until it reboots.
You can use any available port instead of 5555. Replace 5555 with your chosen port in both the adb tcpip command and the Localtonet tunnel configuration. Port 5555 is the standard ADB default and the easiest to remember, so there is rarely a reason to change it.
Step 3: Set Up the Localtonet Android App
Localtonet Android App Setup
Install the Localtonet app on the Android device
Search for Localtonet on Google Play or go to play.google.com/store/apps/details?id=com.localtonet.localtonetapp and install it.
Open the app and enter your AuthToken
Log in to localtonet.com from any browser, go to Dashboard → My Tokens, and copy your AuthToken. Paste it into the Localtonet Android app and tap Confirm.
The app is now authenticated and ready
The app does not start any tunnels on its own. Tunnels are created in the Localtonet dashboard and started via the app. Leave the app open in the background while the tunnel is running.
Step 4: Create the TCP Tunnel in the Localtonet Dashboard
Go to the TCP-UDP Tunnel page
Open localtonet.com/tunnel/tcpudp in your browser.
Configure the tunnel
Fill in the fields:
- Process Type: TCP
- AuthToken: Select the token you used in the Android app
- Server: Choose the server closest to the Android device's physical location for lowest latency
- IP:
127.0.0.1(the ADB daemon runs on localhost on the Android device) - Port:
5555
Click Create.
Start the tunnel from the Android app
Open the Localtonet Android app. The new tunnel appears in the list. Tap Start. The tunnel status changes to Active.
Note the public hostname and port
Back in the dashboard, the tunnel now shows a public address like us1.localtonet.com:23412. This is the address you will use in the adb connect command from any machine.
Step 5: Connect ADB from Your Development Machine
Open a terminal or command prompt
On Windows: press Win+R, type cmd, press Enter. On macOS/Linux: open Terminal.
Connect ADB to the tunnel address
adb connect us1.localtonet.com:23412
Replace us1.localtonet.com:23412 with the actual hostname and port shown in your tunnel dashboard. You should see: connected to us1.localtonet.com:23412.
Verify the connection
adb devices
Your device should appear as us1.localtonet.com:23412 device. If it shows unauthorized, a prompt appeared on the Android device screen asking to authorize the connection. Approve it on the device.
Start using ADB normally
# Install an APK:
adb -s us1.localtonet.com:23412 install myapp.apk
# View logcat:
adb -s us1.localtonet.com:23412 logcat
# Run a shell command:
adb -s us1.localtonet.com:23412 shell
# Take a screenshot:
adb -s us1.localtonet.com:23412 shell screencap -p /sdcard/screen.png
adb -s us1.localtonet.com:23412 pull /sdcard/screen.png
# Push a file to the device:
adb -s us1.localtonet.com:23412 push myfile.txt /sdcard/
If only one device is connected in your ADB session, you can omit the -s flag and all commands will target that device automatically.
Using Android Studio with the Tunnel
Once you have run adb connect us1.localtonet.com:23412 in a terminal, Android Studio automatically detects the device in its device selector. No additional configuration is needed inside Android Studio.
Open your project in Android Studio
Make sure ADB is already connected to the tunnel address in a separate terminal window before opening Android Studio, or connect after Android Studio is already open.
Select the device in the device dropdown
In the toolbar, click the device selector dropdown. Your remote device appears listed by its model name (e.g., "Pixel 7 - Android 14"). Select it.
Run or debug as normal
Press Run (Shift+F10) or Debug (Shift+F9). Android Studio compiles the APK, installs it on the remote device via the tunnel, and launches the app. The debugger attaches just as it would over USB.
For faster incremental installs over the tunnel, go to File → Settings → Build, Execution, Deployment → Debugger and set ADB Server Burst Mode to Enabled. This reduces the overhead of ADB communication, which is particularly noticeable when tunneling over the internet.
Common ADB Commands for Remote Debugging
| Task | ADB Command |
|---|---|
| Connect to tunnel | adb connect us1.localtonet.com:PORT |
| List connected devices | adb devices |
| Install APK | adb install myapp.apk |
| Reinstall APK (keep data) | adb install -r myapp.apk |
| Uninstall app | adb uninstall com.example.myapp |
| View real-time logs | adb logcat |
| Filter logs by tag | adb logcat -s MyTag:V |
| Clear logcat buffer | adb logcat -c |
| Open device shell | adb shell |
| Push file to device | adb push local_file.txt /sdcard/ |
| Pull file from device | adb pull /sdcard/file.txt ./ |
| Take screenshot | adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png |
| Record screen | adb shell screenrecord /sdcard/video.mp4 |
| Restart device | adb reboot |
| Disconnect from tunnel | adb disconnect us1.localtonet.com:PORT |
Security: Protecting Your ADB Tunnel
An ADB connection gives full shell access to the Android device, equivalent to root on many devices. It can install any APK, read all accessible files, run arbitrary commands, and access all app data. Anyone who knows the tunnel's hostname and port can attempt to connect. The steps below are not optional for internet-exposed ADB.
🔒 ADB's built-in RSA key authentication (always active)
When a new machine connects to ADB for the first time, the Android device shows a dialog: "Allow USB debugging from this computer?" with an RSA key fingerprint. The user must tap Allow on the device before the connection is authorized. This is ADB's built-in security layer and applies to network connections too. A new machine cannot silently connect without physical approval on the device. Check "Always allow from this computer" only for trusted development machines.
🌐 Add IP allowlisting on the Localtonet tunnel
In your Localtonet TCP tunnel settings, enable IP allowlisting and add only the IP addresses of your development machines or CI servers. All connection attempts from other IP addresses are rejected at the Localtonet edge, before they even reach your device. This is the most effective way to lock down the tunnel against unauthorized access.
⏱ Stop the tunnel when not in use
TCP tunnels for ADB should not be left running indefinitely. Open the Localtonet Android app and tap Stop when the debugging session is complete. This eliminates the attack surface entirely between sessions. The tunnel configuration is saved and can be restarted in seconds when needed again.
🚫 Disable USB Debugging when not developing
USB Debugging and ADB TCP mode grant significant system access. When you are not actively developing, turn off USB Debugging in Developer Options. This disables ADB access entirely regardless of tunnel state.
📱 Never run on production or sensitive-data devices
ADB gives access to app data for all installed apps, including banking and authentication apps. Only use remote ADB debugging on dedicated test devices that do not contain real user data or sensitive accounts.
Platform-Specific Notes
Windows
ADB is included with Android Studio. To use it from the command prompt without Android Studio, download the SDK Platform Tools ZIP from developer.android.com/tools/releases/platform-tools, extract it, and add the folder to your PATH environment variable. You may also need to install the Google USB Driver or your device manufacturer's USB driver before ADB can detect the device over USB for the initial adb tcpip 5555 step.
# After adding platform-tools to PATH:
adb version
adb devices
adb tcpip 5555
adb connect us1.localtonet.com:23412
macOS
ADB is available via Homebrew: brew install android-platform-tools. Or install Android Studio which includes ADB in ~/Library/Android/sdk/platform-tools/. No driver installation needed on macOS.
brew install android-platform-tools
adb devices
adb tcpip 5555
adb connect us1.localtonet.com:23412
Linux
Install ADB via your package manager:
# Debian/Ubuntu:
sudo apt-get install android-tools-adb
# Fedora:
sudo dnf install android-tools
# Arch Linux:
sudo pacman -S android-tools
On Linux you may also need to add a udev rule to allow your user to access USB devices without root. Android Studio includes a helper for this. Alternatively, run: sudo adb kill-server && sudo adb start-server to run ADB as root for the initial USB connection only.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
adb devices shows nothing after USB connect |
USB Debugging not enabled or driver missing | Confirm USB Debugging is on in Developer Options. On Windows, install the USB driver for your device brand. Try a different USB cable. |
Device shows as unauthorized |
ADB RSA key not approved on device | Check the Android device screen for an "Allow USB Debugging?" dialog and tap Allow. If it never appears, revoke ADB authorizations in Developer Options and reconnect. |
adb connect fails with "Connection refused" |
Tunnel not started or ADB TCP mode not enabled | Confirm the tunnel is Active in the Localtonet Android app. Reconnect USB and run adb tcpip 5555 again (ADB TCP mode resets on reboot). |
adb connect succeeds but commands time out |
High latency or unstable connection | Choose a Localtonet server geographically closer to the Android device. Confirm the device has a stable internet connection. |
Device shows offline in adb devices |
ADB daemon crashed or TCP mode timed out | Run adb kill-server, then adb connect us1.localtonet.com:PORT again. If persistent, re-enable TCP mode via USB. |
| Android Studio does not see the device | ADB not connected before Android Studio checked for devices | Connect ADB in a terminal first, then use Tools → Android → Rescan for Devices in Android Studio. |
| ADB TCP mode not persisting after reboot | Android resets ADB daemon to USB-only on boot | Reconnect USB after reboot and run adb tcpip 5555 again. On rooted devices, use a startup script to automatically set persist.adb.tcp.port. |
| Tunnel Active but cannot connect from a specific network | Network or firewall blocking outbound TCP on tunnel port | Try from a different network (e.g., mobile hotspot). Corporate networks sometimes block outbound TCP on non-standard ports. |
Frequently Asked Questions
Can I use ADB over the internet without port forwarding?
Yes. A Localtonet TCP tunnel creates an outbound encrypted connection from the Android device to Localtonet's servers. No inbound port needs to be open on the Android device's network. The tunnel works behind NAT, CGNAT, and corporate firewalls. From your development machine, you connect to the Localtonet public endpoint using adb connect hostname:port, and ADB works normally.
What port does ADB use for TCP connections?
ADB uses port 5555 by default for TCP connections. This is the port you enable when you run adb tcpip 5555 and the port you configure in the Localtonet TCP tunnel. You can use any available port by replacing 5555 with your chosen port in both commands. The Localtonet public port (e.g., 23412) is separate and assigned by Localtonet, not related to port 5555.
Why does ADB TCP mode stop working after reboot?
Android resets the ADB daemon to USB-only mode on every reboot. This is intentional security behavior. After a reboot you need to reconnect the USB cable and run adb tcpip 5555 again. On rooted devices, you can set the system property persist.adb.tcp.port to 5555 in the build configuration to make TCP mode survive reboots.
Is remote ADB debugging secure?
ADB includes RSA key authentication: any new machine that connects must be approved on the device screen. The Localtonet TCP tunnel adds TLS encryption for the network traffic. For maximum security, enable IP allowlisting in the tunnel settings to restrict which IP addresses can reach the tunnel endpoint, and stop the tunnel when the debugging session ends. Only use remote ADB on dedicated test devices that do not contain sensitive accounts or personal data.
Can I install an APK on a remote Android device over the tunnel?
Yes. Once ADB is connected via the tunnel, all standard ADB commands work, including adb install myapp.apk. The APK is transferred through the tunnel to the device. Transfer speed depends on both the upload speed of the machine sending the APK and the download speed of the Android device's internet connection.
Does this work with Android 11 and the newer Wireless Debugging feature?
Android 11 and later include a built-in Wireless Debugging feature in Developer Options that uses a pairing code instead of USB for the initial connection. However, it only works on the same local Wi-Fi network using mDNS discovery. The Localtonet TCP tunnel approach works on any network and any Android version from Android 5.0 onward, making it the more practical solution for cross-network and internet debugging.
Quick Reference: Full Setup Checklist
| # | Step | Where | Command / Action |
|---|---|---|---|
| 1 | Enable Developer Options | Android device | Tap Build Number 7 times in Settings → About Phone |
| 2 | Enable USB Debugging | Android device | Settings → Developer Options → USB Debugging: ON |
| 3 | Connect USB, verify ADB | PC terminal | adb devices |
| 4 | Enable ADB TCP mode | PC terminal | adb tcpip 5555 |
| 5 | Install Localtonet app | Android device | Google Play: Localtonet |
| 6 | Paste AuthToken in app | Android device | Copy from localtonet.com → My Tokens |
| 7 | Create TCP tunnel | Browser | localtonet.com/tunnel/tcpudp → IP: 127.0.0.1, Port: 5555 |
| 8 | Start the tunnel | Localtonet Android app | Tap Start on the new tunnel |
| 9 | Connect ADB remotely | Any PC, anywhere | adb connect us1.localtonet.com:PORT |
| 10 | Debug normally | Android Studio or terminal | adb install app.apk / adb logcat / etc. |
Debug Your Android Device from Anywhere
Secure TCP tunnel for ADB over the internet. No port forwarding. No static IP. Works on any network. Free to start.
Get Started Free →