Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ADB and Genymotion error: "adb server is out of date. killing... cannot bind 'tcp:5037' ADB server didn't ACK" [duplicate]

Trying to use adb shell from terminal after starting genymotion emulator and I get this error:

adb server is out of date.  killing...
cannot bind 'tcp:5037'
ADB server didn't ACK
* failed to start daemon *
error:

I read in this answer on stackoverflow to run this command killall -9 adbso I did and then it says to change genymotion settings to use custom Android SDK tools as the following:

enter image description here

Also did that as you can see in the above screenshot but I still keep getting the same error message.

My android Studio ADB logs give the following message whenever I try to run adb shell:

 DeviceMonitor: Adb connection Error:EOF
 DeviceMonitor: Connection attempts: 1

I even tried creating a new virtual device and using it without any success.

like image 592
CommonSenseCode Avatar asked Jun 10 '15 13:06

CommonSenseCode


3 Answers

update the adb to 1.0.32 if you have 1.0.31 or lower

adb version
Android Debug Bridge version 1.0.31
wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb
sudo mv adb /usr/bin/adb
sudo chmod +x /usr/bin/adb
adb version
Android Debug Bridge version 1.0.32
like image 62
spawyn Avatar answered Oct 02 '22 01:10

spawyn


Neither of those solutions worked for me at all.

The solution which solved my error was to add both the missing /Android/Sdk/tools & /Android/Sdk/platform-tools directories to my Environment PATH variable,this can be achieved with the following command:

export PATH=/home/{username}/Android/Sdk/tools:/home/{username}/Android/Sdk/platform-tools:$PATH

Be sure to interpolate your own username into the command, replacing {username} with your operating system username.

Doing so will direct your command line to search your Environmant's PATH variable for the proper location of the adb executable, without this environment variable set, your system does not know where to look for the correct executable.

like image 33
Matt G Avatar answered Oct 02 '22 00:10

Matt G


The root cause for this issue is that you try to run adbs of different versions. PC(Host) side adb is made of two parts: adb and adb server.

adb <----> adb server <--------USB-------> adbd(device)

adb and adb server actually is the same binary, but adb server is running at background when you first issue a adb command. After that, adb command will contact which adb server each time you run adb, and first of all it check the versions of running adb server. If version is not match, then you will see 'adb server is out of date. killing...'. This is the only reason.

int adb_connect(const std::string& service, std::string* error) {
    // first query the adb server's version
    int fd = _adb_connect("host:version", error);
...
        if (version != ADB_SERVER_VERSION) {
            printf("adb server is out of date.  killing...\n");
            fd = _adb_connect("host:kill", error);
            adb_close(fd);

            /* XXX can we better detect its death? */
            adb_sleep_ms(2000);
            goto start_server;
        }

To resolve this problem, you just need to make sure you are not tring to run different version adb.

  1. Find the binary path of running adb server by using a task manager tool, search "adb". check its version using command

[path to adb server]/adb version

The output like this:

Android Debug Bridge version 1.0.35
Revision 68de85bda98d-android

"1.0.35" is the version number.

  1. check the version of the adb which cause your problem. just type

adb version

  1. compare the version numbers, they must match.

if they are not matched, you can:

  • just keep only one adb, delete others.
  • or you can ignore the error. if it always shows, find out who is running different adb tool for you and stop it. For example, some phone assistant program.
like image 5
Changbin Du Avatar answered Oct 02 '22 01:10

Changbin Du