adb commands, Android Studio, and other ADB-dependent workflows.
Overview
The ADB tunnel creates a local TCP connection that forwards to the Android instance’s ADB server over WebSocket. This allows you to:- Run
adb devicesto see the connected device - Use Android Studio for debugging
- Execute any
adbcommand (shell, logcat, install, etc.) - Use Scrcpy for screen mirroring
Complete Example
How It Works
1. Creating the Tunnel
ThestartAdbTunnel() method:
- Creates a local TCP server
- Forwards all traffic to the Android instance via WebSocket
- Returns the local address and a cleanup function
2. Using ADB Commands
Once the tunnel is established, use standard ADB commands:3. Connection Monitoring
The tunnel automatically handles reconnection if the WebSocket connection drops:4. Cleanup
Always close the tunnel when done:Android Studio Integration
To use Android Studio with Limrun instances:Advanced Usage
Tunnel Modes
The tunnel supports two modes:Custom Reconnection
Configure reconnection behavior:Use Cases
Development
Use Android Studio, VS Code, or IntelliJ for development
Debugging
Use Android Profiler, logcat, and debugger tools
Testing
Run instrumented tests using Espresso or UI Automator
Automation
Integrate with CI/CD pipelines using ADB commands
Next Steps
Tunneling Guide
Learn more about TCP tunneling
Android Instances
Explore Android instance features