Automatically enable wireless ADB debugging and switch to port 5555 on every boot - completely autonomous, no root required!
Perfect for Chromecast with Google TV, Android TV boxes, and any Android device where you want persistent wireless ADB access without manual intervention.
Android 14 introduces enhanced ADB security which disables and randomises the port used after sleep/reboot, breaking my automation setup. Auto ADB Enable automatically re-enables wireless ADB, maintaining remote access for non-interactive devices.
However, this is likely a temporary workaround. This app is part of a three-app ecosystem designed to progressively eliminate my ADB dependency:
- Auto ADB Enable (this app) - Stopgap to maintain ADB access
- Display Launcher - ADB-free app control via REST API
- Android Stream Viewer - ADB-free camera display with web configuration
Used together, Display Launcher and Stream Viewer eliminate the need for ADB entirely. Display Launcher handles app launching (including Stream Viewer with specific cameras), while Stream Viewer provides fully web-configurable camera displays. Auto ADB Enable remains available for edge cases, but the long-term goal is complete ADB-free operation.
Warning
SECURITY WARNING: This application enables Android Debug Bridge (ADB) on port 5555, which provides remote access to your device with full system privileges. While ADB connections require RSA key authentication (users must accept the connection on first pairing), once a computer is authorized, it has permanent unrestricted access to install applications, access all data, execute shell commands, and take complete control of your device without further prompts. Additionally, the RSA authentication prompt is vulnerable to overlay attacks where malicious apps can trick users into authorizing connections. This app should ONLY be used on isolated or trusted networks (such as a home network behind a firewall with no port forwarding) and NEVER on public WiFi, guest networks, or any network you do not fully control. Exposing ADB to the internet or untrusted networks can result in complete device compromise if an attacker gains authorization, either through social engineering, overlay attacks, or physical access to previously paired computers. Use this tool only on devices you own and ensure your network is properly secured with a firewall blocking external access to port 5555.
- Tested only on CCwGTV. May not work at all on wired devices.
- π Fully Autonomous: Automatically enables wireless debugging and switches to port 5555 on every boot
- π± No Root Required: Works on non-rooted devices with a one-time pairing via the web UI
- π Web UI: Clean web interface at
http://device-ip:9093for status, pairing, and live logs - π Smart Retry: Implements retry logic with WiFi connection monitoring for reliability
- π Auto-Permission Grant: Automatically grants itself WRITE_SECURE_SETTINGS after pairing (no PC required!)
- π Live Logs: View real-time logs directly in the web interface with copy-to-clipboard functionality
- π‘οΈ Background Persistence: Web server runs in a foreground service, survives app backgrounding
- One-Time Pairing: App pairs with itself via localhost, storing authentication keys
- Auto-Grant Permission: After pairing, app automatically grants itself WRITE_SECURE_SETTINGS permission via ADB
- Boot Detection: On device boot, service starts automatically (with WiFi monitoring and 60s stabilization delay)
- Enable Wireless Debugging: Enables wireless debugging via
Settings.Global - Port Discovery: Discovers the random ADB port using mDNS or port scanning
- Self-Connection: Connects to local ADB daemon using stored authentication keys
- Port Switch: Sends
tcpip:5555command to ADB daemon to switch to fixed port - Done!: ADB is now available on port 5555 for external connections - completely autonomous!
- Android 13+ (tested on Chromecast with Google TV)
- WiFi connection
- No PC or ADB required after initial APK installation!
Download and install the APK from Releases, or build from source:
git clone https://github.com/mouldybread/adb-auto-enable.git
cd adb-auto-enable
./gradlew assembleRelease
adb install app/build/outputs/apk/release/app-release.apk- Open the app or navigate to
http://your-device-ip:9093in a browser - On your Android device:
- Go to Settings β Developer Options β Wireless Debugging
- Tap "Pair device with pairing code"
- Enter the pairing code and pairing port into the web interface
- Click "Pair Device"
- The app will automatically attempt to grant itself permissions!
- Check the web UI status - Permission should show "β Granted"
- Click "Switch to Port 5555 Now" to test the configuration
- Check "ADB Port 5555" status - should show "β Available"
Reboot your device:
adb rebootWait about 90 seconds (60s boot delay + 30s for configuration), then connect:
adb connect your-device-ip:5555Access the web interface at http://device-ip:9093 to:
- β View system status (permissions, pairing, port availability)
- π Perform one-time pairing (no PC required!)
- π Manually trigger port switch
- π§ͺ Test the boot configuration sequence
- π View live logs with auto-refresh and copy-to-clipboard
- π Monitor last boot status and discovered ports
Edit AdbConfigService.java:
private static final int INITIAL_BOOT_DELAY_SECONDS = 60; // Adjust as neededprivate static final int MAX_RETRY_ATTEMPTS = 3;
private static final int RETRY_DELAY_SECONDS = 15;Edit AdbConfigService.java and MainActivity.java:
private static final int WEB_SERVER_PORT = 9093; // Change portIf auto-grant fails, you can manually grant the permission from a computer:
1. Verify Permission Status:
adb shell dumpsys package com.tpn.adbautoenable | grep WRITE_SECURE_SETTINGSYou should see:
android.permission.WRITE_SECURE_SETTINGS: granted=true
2. Manual Permission Grant:
If permission is not granted, connect via USB and run:
adb shell pm grant com.tpn.adbautoenable android.permission.WRITE_SECURE_SETTINGS3. Common Issues:
Issue: Permission Monitoring Blocked the Grant (OnePlus, ColorOS, Xiaomi devices)
On your Android device:
- Go to Settings β Developer Options
- Find "Disable Permission Monitoring" and enable it
- Toggle USB Debugging OFF and back ON
- Try pairing again in the web UI
Issue: App Was Running When Permission Was Granted
adb shell am force-stop com.tpn.adbautoenable
adb shell pm grant com.tpn.adbautoenable android.permission.WRITE_SECURE_SETTINGSIssue: Permission State Is "Stuck"
adb shell cmd appops reset com.tpn.adbautoenable
adb shell pm grant com.tpn.adbautoenable android.permission.WRITE_SECURE_SETTINGSCheck logs in the web UI at http://device-ip:9093 or via ADB:
adb logcat -s ADBAutoEnableLook for:
"Boot event detected, starting ADB configuration service...""Waiting for WiFi connection...""Successfully configured ADB on port 5555!"
- Verify permission is granted (see above)
- Check pairing status in web UI - must show "β Paired"
- Try manual trigger via web UI button
- Check live logs in web UI for detailed error messages
Increase the WiFi wait timeout in AdbConfigService.java:
int maxWaitSeconds = 120; // Increase to 180 or moreCheck for foreground service permission errors:
adb logcat | grep -i "foreground"Ensure AndroidManifest.xml has:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />The web server runs on port 9093 in a foreground service. If you can't access it:
-
Check that the service is running:
adb shell dumpsys activity services | grep AdbConfigService -
Verify the device IP address in the app's main screen
-
Try accessing from the same network:
http://device-ip:9093
adb-auto-enable/
βββ app/src/main/java/com/tpn/adbautoenable/
β βββ MainActivity.java # Main activity that starts the service
β βββ AdbConfigService.java # Foreground service with web server
β βββ BootReceiver.java # Boot broadcast receiver
β βββ AdbHelper.java # ADB protocol implementation
β βββ WebServer.java # NanoHTTPD web interface with live logs
βββ app/src/main/AndroidManifest.xml
βββ README.md
The app implements the ADB wire protocol:
- CONNECT message with
host::featuresservice - AUTH signature/token exchange for authentication
- OPEN service channel to ADB daemon
- WRITE commands like
tcpip:5555andpm grant
Authentication keys are stored in /data/data/com.tpn.adbautoenable/files/adb_keys/.
LOCKED_BOOT_COMPLETED β BootReceiver β AdbConfigService (Foreground)
β
Start Web Server (port 9093)
β
Wait for WiFi (up to 2 min)
β
Wait for system stabilization (60s)
β
Enable wireless debugging
β
Wait 10s for ADB daemon
β
Discover port (mDNS β fallback to scan)
β
Connect to local ADB
β
Send tcpip:5555 command
β
Success! (with 3 retry attempts if needed)
User Pairs via Web UI (localhost:random-port)
β
Pairing successful, keys stored
β
App discovers current ADB port (mDNS/scan)
β
App connects to localhost:discovered-port
β
App executes: shell:pm grant com.tpn.adbautoenable android.permission.WRITE_SECURE_SETTINGS
β
Permission granted autonomously!
- Google, for forcing my hardware to update consequently creating this mess
- This Home Assistant Issue
- Inspired by various Tasker projects and Magisk modules
- Uses NanoHTTPD for embedded web server
- Uses libadb-android for ADB protocol implementation
