Note: since adb version 35, there is built-in support in android studio to auto-connect via adb to your android phone, which makes this tool obsolete! However, since I could not quickly get this running outside of android studio, e.g. via command line, maybe this tool has some extened life.
Easy and convenient way to auto-connect to your android phone with adb over WIFI in a daemon like way.
OS | Supported |
---|---|
![]() |
yes |
![]() |
should work(happy about user feedback) |
![]() |
could work(happy about user feedback) |
OS | Supported |
---|---|
![]() |
Any android version that supports wireless debugging should work. The phone needs NOT be rooted! |
- Make sure you are a developer: Tap the build number seven times in Settings > About phone.
- Enable Wireless Debugging in System > Developer Options.
- Note down the IP address and port number that is displayed when being in Wireless Debugging menu (previous step).
- Tap 'Pair device with paring code.'
- Recommendation to avoid having to regularly re-pair: Tap 'Disable adb authorisation timeout' in 'Developer Options' menu.
- Install https://nmap.org/download.html and https://developer.android.com/studio and make sure the adb command is on the PATH!
adb pair <your ip from step 1.4>:<your port from step 1.4>
, e.g.adb pair 10.0.0.4:42707
and enter the pairing code (step 1.4).- Install this tool:
git clone "https://github.com/gernotfeichter/adb-wifi-connect.d.git" "${HOME}/.adb-wifi-connect.d"
- Configure this tool: Edit the file "${HOME}/.adb-wifi-connect.d/config.sh" and set the ANDROID_HOSTS to the correct IP of the device (from step 1.3). Further docu within the file.
- Run Android Studio or any IDE process you registered in the previous step (setting
REQUIRED_PROCESSES
). - Run this tool:
cd "${HOME}/.adb-wifi-connect.d" && ./run.sh
- Wait a little, scanning a single ip over all ports takes about 30s, behold if you chose a range of ips!
- Now you should see the device in the dropdown when opening Android Studio!
If you like what this did and want to connect permanently, add step 2.6 to your autostart. In case you followed the conventions you should be able to directly add "${HOME}/.adb-wifi-connect.d/daemon.sh" to your autostart!
Check the log file:
tail -F ~/.adb-wifi-connect.d/log
this kills the daemon:
pkill -f .adb-wifi-connect.d
the daemon however spans another subprocess (run.sh
script), it should die soon after the daemon
was killed.
When enabling wireless debugging on android phones you get a dynamic debugging port per default. Re-connecting becomes a burden, because the port number typically has to be re-typed on each new connect, this involves two manual steps:
- opening the Wireless Debugging menu on your phone and enabling wireless debugging
- typing the adb connect command with parameters obtained from the previous step
This is partially automated by this tool, such that step 1. is the only manual step that is required.
Per default configuration, this tool automatically connects to previously paired devices given that:
- Android Studio is running (or any other configured IDE, see setting
REQUIRED_PROCESSES
) - No other device is already connected
GNU GENERAL PUBLIC LICENSE Version 2, see LICENSE