I use Xubuntu (Ubuntu flavor) system. I've installed Android Studio (using default instructions). It was working fine, I think that I did not reboot the system since I did this. Now after I've shutdown the computer (I was away) when I boot it my react-native stopped working because the adb
gives errors:
$ 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
I've searched multiple similar questions and did not find a way to fix the issue. I was also asking chatGPT it suggested reinstalling SDK (which I did and it did not help).
NOTE that I have the same setup on my personal laptop with Fedora and it's working fine.
EDIT: I've enabled logging but I have no clue what is wrong:
$ 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
EDIT: what's weird is that I can run Simple Python HTTP server on adb port without any issues:
$ 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 -
but after stopping it and running adb
it gives the same error.
EDIT(2) I've tried to install adb
from the Ubuntu package android-sdk-platform-tools-common
but got the same error if running this version of adb
.
I was searching multiple questions and found some not related questions with this command:
adb server
This seems to solve my problem. I need to run this every time I reboot my computer otherwise adb
does not work. The server doesn't start on its own. I don't need to do this on my other laptop with Fedora only on Xubuntu.