我使用Xubuntu(Ubuntu风格)系统。我已经安装了 Android Studio(使用默认说明)。它工作正常,我认为自从我这样做以来我没有重新启动系统。现在,当我关闭计算机(我离开)后,当我启动它时,我的反应本机停止工作,因为
adb
给出了错误:
$ ps aux | grep adb
jakubja+ 9484 0.0 0.0 22036 2412 pts/0 S+ 15:30 0:00 grep --color=auto adb
$ adb kill-server
error: failed to read response from server
$ adb start-server
error: protocol fault (couldn't read status): Connection reset by peer
$ adb -P 19999 start-server
error: protocol fault (couldn't read status): Connection reset by peer
$ adb devices
adb: failed to check server version: protocol fault (couldn't read status): Connection reset by peer
我搜索了多个类似的问题,但没有找到解决问题的方法。我还问过 chatGPT,它建议重新安装 SDK(我这样做了,但没有帮助)。
请注意,我在我的个人笔记本电脑上使用 Fedora 进行了相同的设置,并且运行良好。
编辑:我已启用日志记录,但我不知道出了什么问题:
$ export ADB_TRACE=all
$ adb start-server
07-18 17:03:20.431 4870 4870 D adb : adb_trace.cpp:187 Android Debug Bridge version 1.0.41
07-18 17:03:20.431 4870 4870 D adb : adb_trace.cpp:187 Version 34.0.4-10411341
07-18 17:03:20.431 4870 4870 D adb : adb_trace.cpp:187 Installed as /home/jakubjankiewicz/Android/Sdk/platform-tools/adb
07-18 17:03:20.431 4870 4870 D adb : adb_trace.cpp:187 Running on Linux 5.19.0-46-generic (x86_64)
07-18 17:03:20.431 4870 4870 D adb : adb_trace.cpp:187
07-18 17:03:20.431 4870 4870 D adb : adb_client.cpp:358 adb_connect: service: host:start-server
07-18 17:03:20.431 4870 4870 D adb : adb_client.cpp:160 _adb_connect: host:version
07-18 17:03:20.432 4870 4870 D adb : adb_io.cpp:107 writex: fd=3 len=16 30303063686f73743a76657273696f6e 000chost:version
07-18 17:03:20.432 4870 4870 D adb : adb_io.cpp:81 readx: fd=3 wanted=4
07-18 17:03:20.432 4870 4870 D adb : adb_io.cpp:88 readx: fd=3 error 104: Connection reset by peer
error: protocol fault (couldn't read status): Connection reset by peer
编辑:奇怪的是我可以在 adb 端口上运行简单的 Python HTTP 服务器,没有任何问题:
$ python3 -m http.server 5037
Serving HTTP on 0.0.0.0 port 5037 (http://0.0.0.0:5037/) ...
127.0.0.1 - - [19/Jul/2023 09:39:39] "GET / HTTP/1.1" 200 -
但是停止并运行后
adb
它给出了相同的错误。
编辑(2) 我尝试从 Ubuntu 软件包
adb
安装 android-sdk-platform-tools-common
,但如果运行此版本的 adb
,则会出现相同的错误。
我正在搜索多个问题,发现一些与此命令不相关的问题:
adb server
这似乎解决了我的问题。我每次重新启动计算机时都需要运行此命令,否则
adb
不起作用。服务器不会自行启动。我不需要在我的另一台笔记本电脑上执行此操作,仅在 Xubuntu 上使用 Fedora。