Deutsch English Français Italiano |
<t5rtfn$b70c$1@news.mixmin.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!.POSTED!sewer!alphared!news.uzoreto.com!aioe.org!uC+u+wrvCiJRhswcuU7oWw.user.46.165.242.75.POSTED!not-for-mail From: Andy Burnelli <spam@nospam.com> Newsgroups: alt.comp.freeware,alt.comp.os.windows-11,microsoft.public.windowsxp.general Subject: Tutorial: Working examples using Android/Windows adb freeware over Wi-Fi Date: Sun, 15 May 2022 23:06:07 +0100 Organization: Mixmin Message-ID: <t5rtfn$b70c$1@news.mixmin.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 15 May 2022 22:05:44 -0000 (UTC) Injection-Info: news.mixmin.net; posting-host="d69badb3e6e93515d6f6b0152dd223744cfd45c3"; logging-data="367628"; mail-complaints-to="abuse@mixmin.net" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-GB Bytes: 21593 Lines: 449 Tutorial: Working examples using Android/Windows adb over Wi-Fi The documentation below is designed to be as cut-&-paste as possible. This tutorial assumes you already installed adb & enabled USB debugging. <https://source.android.com/setup/build/adb> Note this was tested WITHOUT the Android SDK; it just needs "adb.exe". Android 11 and up allows adb connections purely over Wi-Fi (with no initial or continued need for USB cables) which allows mirroring over Wi-Fi using any of a variety of free & FOSS tools such as: a. Vysor b. Scrcpy c. Microsoft Phone Link plus Microsoft/Samsung Link to Windows Those local/remote mirror tools are described in gory detail here: *What free software do you use to locally mirror Android over Windows* <https://groups.google.com/g/alt.comp.microsoft.windows/c/eMYBmpq2H50> *What free software do you use to remotely control Android over Windows* <https://groups.google.com/g/comp.mobile.android/c/7toIA9mxX4o/m/DAmq_Z4PAgAJ> While screen mirroring is fantastic, what this tutorial focuses on is using the Android Debug Bridge (adb) commands over Wi-Fi from Windows. Prior to Android 11, if the user wished to use adb with Android over Wi-Fi, the adb connection had to be initially _established_ over a USB cable. There is much information about that problem set, only summarized below. 1. C:\> adb kill-server (optional, but it helps for a starting point) 2. Connect the Android phone to USB (mandatory on Android 10 & below). 3. Connect to the Android phone over USB. C:\> adb connect Or C:\> adb reconnect You should see an output of something like: * daemon not running; starting now at tcp:5037 * daemon started successfully reconnecting ABCDEFGHIJK [device] 4. C:\> adb tcpip 5555 You want one of these two show up: restarting in TCP mode port: 5555 Or... * daemon not running; starting now at tcp:5037 * daemon started successfully restarting in TCP mode port: 5555 Not this: * daemon not running; starting now at tcp:5037 * daemon started successfully error: no devices/emulators found But you might get this if you started from scratch * daemon not running; starting now at tcp:5037 * daemon started successfully error: device unauthorized. This adb server's $ADB_VENDOR_KEYS is not set Try 'adb kill-server' if that seems wrong. Otherwise check for a confirmation dialog on your device. If you do, just press "Allow" & "Remember" on the phone when it asks. 5. At this point you can disconnect the USB cable (or leave it connected). 6. To connect over Wi-Fi, this always works at this stage in the process. C:\> adb connect 192.168.0.2 Or, if you're a stickler for details, specifying the port works too. C:\> adb connect 192.168.0.2:5555 In either case, you want to see this: connected to 192.168.0.2:5555 7. At this point you are completely connected: C:\> adb devices That should output either this (if you left the USB connected). List of devices attached ABCDEFGHIJ device 192.168.0.2:5555 device Or this (if you disconnected the USB already). List of devices attached 192.168.0.2:5555 device However, as of Android 11 and up, it's now possible to pair your Android phone to your over Wi-Fi Windows computer without ever needing a USB cable. That instantly negates the need for the workaround above, detailed below. *Android Studio wireless ADB error (10061)* <https://stackoverflow.com/questions/37267335/android-studio-wireless-adb-error-10061> That 5-year old wireless/usb workaround was updated on Oct 4, 2021. Here's a description of the new adb Wi-Fi capabilities in Android 11+ <https://www.makeuseof.com/tag/new-adb-make-process-simple-easy/> "If you're on Android 11 (with SDK platform tool version 30 or greater) and above, you can use wireless debugging to pair your device with the computer. This Wi-Fi pairing method uses a new adb command called 'pair' which works similar to how Bluetooth pairing works." The _new_ command sequence to pair Windows adb to Android over Wi-Fi is: A. Optionally, start at a known default starting point on Windows. C:\> adb kill-server B. Optionally, start at a known default starting point on Android. Settings > Developer options > Revoke USB debugging authorizations C. Make sure these Android 11+ settings are turned on. Settings > Developer options > USB debugging = On Settings > Developer options > Wireless debugging = On Optionally: Settings > Developer options > Disable adb authorization timeout = On Then, to connect Windows adb to your Android 11+ phone over Wi-Fi: <https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+> 1. Long press on Android "Developer options > Wireless debugging" settings. 2. Press the "Pair device with pairing code" option item. This will report something like the following information: Pair with device: Wi-Fi six-digit pairing code: 123456 IP address & Port: 192.168.0.2:54321 3. C:\> adb pair 192.168.0.2:54321 123456 You should see something like this on the phone: Successfully paired to 192.168.0.2:54321 [guid=adb-{serial number}] 4. C:\> adb connect 192.168.0.2:54321 Now you can issue adb commands from Windows over Wi-Fi to an Android phone. C:\> adb devices That should report the devices that adb is connected to, for example: List of devices attached 192.168.0.2:54321 device C:\> adb shell netstat That should list the phone's TCP/IP connectivity tables. C:\> adb shell service list That should list all the running services on the phone. C:\> adb shell ps That should list all the running processes on the phone. C:\> adb shell ifconfig That should provide your Android network interface information. C:\> adb shell "cd /sdcard/Download && ls" That should list files in your internal storage Download folder. C:\> adb shell "cd /sdcard && mkdir temp" That should create a "temp" directory in your internal storage sdcard on your Android phone. C:\> adb shell screencap -p /sdcard/temp/screenshot.png That should snap a screenshot of your android phone & store it in the newly created temp folder on the Android phone. C:\> adb shell screenrecord /sdcard/temp/screenrecord.mp4 Do whatever on the Android phone & then press Ctrl+C to end. That should create an MP4 recording of your Android screen. C:\> adb install "C:\path-to\filename.apk" That should install the APK from Windows over Wi-Fi onto Android. (Note this is useful when you have hundreds of apps like I do!) <https://i.postimg.cc/bN875p8b/apk01.jpg> Windows APK archive C:\> adb push "C:\path-to\filename.apk" /sdcard/Download That should copy the named file from Windows to Android & (in this case) put it in your internal storage "Download" folder. Note that each phone OEM "can" use a different filespec for internal & external sdcards (e.g., /storage/emulated/0/Download). C:\> adb push C:\path\apk_archive\ /sdcard/Download/apks That should create a folder named "apks" in the Android phone's internal storage "Download" folder and then copy all the files from the Windows "apk_archive" folder into that new "apks" folder. C:\> adb shell $ /storage/emulated/0/DCIM $ ls $ exit That should allow you to interactively manage the Android filesystem from Windows over Wi-Fi. Note these are common: /mnt/sdcard/DCIM /sdcard/DCIM /sdcard/DCIM C:\> adb logcat Use this if you're a glutton for punishment as it will forever spit out a log of what's going on your phone (until you Ctrl+C). C:\> adb logcat *:E The values are: V: Verbose (lowest priority) D: Debug I: Info W: Warning ========== REMAINDER OF ARTICLE TRUNCATED ==========