23

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.

Community
  • 1
  • 1
CommonSenseCode
  • 23,522
  • 33
  • 131
  • 186
  • 2
    did you try `adb kill-server` ? Updating Android Tools ? – Hugo Gresse Jun 10 '15 at 13:10
  • thanks Hugo after typing that command it displays: `deamon not running. starting it now on port 5037 deamon started succesfully` then `error: device not found` . I'm sure this is a genymotion problem I tried to run adb shell with my android phone and with Android Studio built in emulator and it worked just fine – CommonSenseCode Jun 10 '15 at 14:55
  • so is it working now ? if not, try to update your android sdk AND genymotion – Hugo Gresse Jun 10 '15 at 15:08
  • Nope, I'll try updating genymotion and also the sdk thanks – CommonSenseCode Jun 10 '15 at 15:40
  • you could try to restart AS and genymotion with their emulators after calling adb kill-server – Hugo Gresse Jun 10 '15 at 15:43
  • `adb server is out of date` error is pretty self explanatory. You have multiple copies of `adb` installed in your system http://stackoverflow.com/a/29524143/1778421 – Alex P. Jun 10 '15 at 17:47
  • 1
    look at this answer: http://stackoverflow.com/a/26431991/779408 – Bob Aug 25 '15 at 06:59
  • It could be because of multiple adb. Do a symlink or set the path correctly. For my case, one adb is at usr/local/bin/adb while the other one is the android-sdk directory. – Jun Nov 24 '17 at 08:17

3 Answers3

28

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
spawyn
  • 411
  • 5
  • 4
  • Worked for me. Thanks – Suresh Nov 12 '15 at 14:52
  • 1
    Thanks man! This was a constant headache for me. Solved it finally. – Anoop Thiruonam Jan 06 '16 at 18:03
  • After this command wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb result I got tar: Exiting with failure status due to previous errors – lazy lord Feb 01 '16 at 05:18
  • 1
    adb might be elsewhere, for instance I have it it /usr/local/bin/adb (OS X), so if you get any error during spawyn response, use which adb to figure out where it is. – gderaco Sep 27 '16 at 10:00
22

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.

Matt G
  • 1,332
  • 2
  • 13
  • 25
5

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.
Changbin Du
  • 501
  • 5
  • 11