今天更新了 SDK Tools 的版本之后,打开命令行发现 adb shell 突然不能用了
报错如下:
$ adb shell
adb server version (40) doesn't match this client (41); killing...
ADB server didn't ACK
Full server startup log: /var/folders/hv/5bc7sv6s7y7807qp6tt43fz40000gn/T//adb.501.log
Server had pid: 1022
--- adb starting (pid 1022) ---
adb I 06-06 21:45:58 1022 9222 main.cpp:60] Android Debug Bridge version 1.0.41
adb I 06-06 21:45:58 1022 9222 main.cpp:60] Version 29.0.0-5611747
adb I 06-06 21:45:58 1022 9222 main.cpp:60] Installed as /Users/binguner/Library/Android/sdk/platform-tools/adb
adb I 06-06 21:45:58 1022 9222 main.cpp:60]
adb E 06-06 21:45:58 1022 9225 usb_osx.cpp:159] Unable to create an interface plug-in (e00002be)
--- adb starting (pid 1024) ---
adb I 06-06 21:45:58 1024 9229 main.cpp:56] Android Debug Bridge version 1.0.40
adb I 06-06 21:45:58 1024 9229 main.cpp:56] Version 86
adb I 06-06 21:45:58 1024 9229 main.cpp:56] Installed as /Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS/tools/adb
adb I 06-06 21:45:58 1024 9229 main.cpp:56]
adb E 06-06 21:45:58 1024 9231 usb_osx.cpp:159] Unable to create an interface plug-in (e00002be)
adb I 06-06 21:45:58 1022 9222 auth.cpp:436] adb_auth_init...
adb server killed by remote request
--- adb starting (pid 1026) ---
* failed to start daemon
error: cannot connect to daemon
然后开始各种百度、谷歌。。。总结了一下解决方案如下:
- 修改 Genymotion 使用的 SDK 版本为系统本地的 SDK 版本
- 查看本地 SDK 的环境变量版本是否正确
-
adb kill-server
然后adb start-server
- 查看进程占用情况,模拟器端口是否被手机助手占用
- ....
但这些解决方案我这里统统失效,查看我的报错信息,确实是我使用的 ADB 版本和虚拟机的 ADB 版本不一样所导致的原因,然后我把 Genymotion 的 SDK 路径修改成本地 SDK 的路径之后。
$ adb shell
error: no devices/emulators found
欲哭无泪。。。
但是突然想到以前用过 adb connect
去无线连接过同一网络环境下的 Android 设备,那么我能不能用 adb connect
去连接这部虚拟机呢?
$ ps aux | grep adb
binguner 1505 0.0 0.0 4295704 848 s000 R+ 9:48PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn adb
binguner 1149 0.0 0.0 4290856 1568 ?? S 9:47PM 0:00.01 /Users/binguner/Library/Android/sdk//platform-tools/adb -s 192.168.57.102:5555 logcat -v time
binguner 1146 0.0 0.0 4338192 2832 ?? Ss 9:47PM 0:00.26 adb -L tcp:5037 fork-server server --reply-fd 11
192.168.57.102:5555
是手机的 ip 和端口,然后使用 adb connect
$ adb connect 192.168.57.102:5555
connected to 192.168.57.102:5555
最后输入熟悉的 adb shell
命令
$ adb shell
root@vbox86p:/ #
问题解决!