adb server version doesn't match this client

2018-12-31 13:26发布

Whenever I try to run adb devices:

            $ adb devices
            * daemon not running. starting it now *
            * daemon started successfully *
            List of devices attached
            HT0ANRV05740    device

It says daemon is not running and restarts the daemon.

Then, if I run adb devices again, it does the same thing -

            $ adb devices
            adb server is out of date.  killing...
            * daemon started successfully *
            List of devices attached
            HT0ANRV05740    device

Then, if I run it again, it again does the exact same thing -

            $ adb devices
            adb server is out of date.  killing...
            * daemon started successfully *
            List of devices attached
            HT0ANRV05740    device

Please help!!

Also, my DDMS keeps giving me the following message -

[2011-02-23 16:17:05 - DeviceMonitor]Adb connection Error:An existing connection was forcibly closed by the remote host

Here are the logs from just before adb restarts -

              1291        locapi_rpc_glue  V  loc_ioctl
              1291                    RPC  D  written RPC packet size: [480]
              1291                    RPC  D  read RPC packet
              1291                    RPC  D  read RPC packet size: [28]
              1291             lib_locapi  V  qct_loc_eng_inject_xtra_data, inject part = 100, len = 167, len = 167
              1291             lib_locapi  V  qct_loc_eng_inject_xtra_data, total part = 100, len = 167
              1291        locapi_rpc_glue  V  loc_ioctl
              1291                    RPC  D  written RPC packet size: [248]
              1291                    RPC  D  read RPC packet
              1291                    RPC  D  read RPC packet size: [28]
              1291             lib_locapi  D  qct_loc_eng_inject_xtra_data: injected 39767, SUCCESS
              1291             lib_locapi  V  inject_xtra_waiting = flase
              1291    GpsLocationProvider  D  Releasing wakelock
              1291            WifiService  D  releaseWifiLockLocked: WifiLock{NetworkLocationProvider type=2 binder=android.os.Binder@47aead50}
              1291            WifiService  D  enable and start wifi due to updateWifiState
              1218            rmt_storage  I  rmt_storage open event
              1218            rmt_storage  I  rmt_storage client thread started
              1218            rmt_storage  I  rmt_storage events processing done
              1218            rmt_storage  I  rmt_storage register cb event
              1218            rmt_storage  I  rmt_storage status id = 2
              1218            rmt_storage  I  rmt_storage events processing done
              1218            rmt_storage  I  rmt_storage open event
              1218            rmt_storage  I  rmt_storage client thread started
              1218            rmt_storage  I  rmt_storage events processing done
              1218            rmt_storage  I  rmt_storage register cb event
              1218            rmt_storage  I  rmt_storage status id = 2
              1218            rmt_storage  I  rmt_storage events processing done
              1218            rmt_storage  I  rmt_storage write event
              1218            rmt_storage  I  unblock rmt_storage client thread
              1218            rmt_storage  I  rmt_storage events processing done
              1218            rmt_storage  I  rmt_storage write: bytes written = 3145216
              1218            rmt_storage  I  rmt_storage write: bytes written = 512
              1218            rmt_storage  I  rmt_storage status handle = 1
              1291       BatteryStatsImpl  I  notePhoneSignalStrengthLocked: 4->3
              1218            rmt_storage  I  rmt_storage write event
              1218            rmt_storage  I  rmt_storage events processing done
              1218            rmt_storage  I  unblock rmt_storage client thread
              1291    PowerManagerService  D  New lightsensor value:40, lcdValue:143
              1291    PowerManagerService  D  lightSensorChangedLocked, buttonValue >= 0, mPowerState = 3
              1218            rmt_storage  I  rmt_storage write: bytes written = 3145216
              1218            rmt_storage  I  rmt_storage write: bytes written = 512
              1218            rmt_storage  I  rmt_storage status handle = 2
              1291                    RPC  D  read RPC packet
              1291                    RPC  D  read RPC packet size: [80]
              1291        locapi_rpc_glue  V  Callback received: 80 (cb_id=0x50B0000 handle=1)
              1291                    RPC  D  written RPC packet size: [28]
              1470   usicWidgetController  D  unbindMusicPlaybackService()
              1707   MediaPlaybackService  E  BadQueue mPlayListLen : 0 mAlbumListLen : 0 mShrinkAlbumListLen : 0
              1291    NotificationService  V  Battery Full, Charging
              1291                 lights  E  write ok string=0,len=1
              1291                 lights  E  write ok string=0,len=1
              1291                 lights  E  write ok string=0 0,len=3
              1291                 lights  E  write ok string=1,len=1
              1707       MediaPlayer.java  D  setOnCompletionListener being cleaned to null
              1291                 lights  E  write ok string=0,len=1
              1291                 lights  E  write ok string=0 0,len=3
              1291    NotificationService  V  Turn off Jogball/OJ LED
              1291    NotificationService  D  cancelNotification, ACTION_NOTIFICATION_REMOVE,pkg=com.htc.music,id=1
              1291           AudioService  I   AudioFocus  abandonAudioFocus() from android.media.AudioManager@476ddee0com.htc.music.MediaPlaybackService$5@476dd838

标签: android adb
30条回答
旧人旧事旧时光
2楼-- · 2018-12-31 14:01

I find I occasionally need to explicitly kill and restart the server manually:

adb kill-server
adb start-server

This shock is generally enough to get it back on its feet again, and prevents repeated adb server is out of date. killing... messages.

查看更多
皆成旧梦
3楼-- · 2018-12-31 14:01

Ensure that there are no other adb processes running

There may be more than one adb process running on the system. Tools such as the Android Reverse Tether may use their own version of the adb tool, hence the version in memory may conflict with the version run from the command line (via the path variable).

Windows

In Windows, press CTL+Shift+ESC to access Task Manager, sort in the Image Name column, then kill all instances of adb.exe by right-clicking, and choosing End Process. Note that there are multiple instances of adb.exe below:

Multiple adb.exe instances - how to kill

Linux (Android)

In a Linux environment, just use the kill -9 command. Something like this worked on an Android device running adb (use ps output, search using grep for a process starting with adb, get the Process ID from the adb process(es), and send that ID to the kill -9 command):

kill -9  $(ps  | grep "S adb" | busybox awk '{print $2}')

Then, restart adb

Once the adb processes - and thus conflicts - are resolved, then retry running adb from the command-line again:

adb start-server
查看更多
浮光初槿花落
4楼-- · 2018-12-31 14:01

OS: Ubuntu

There are more than 1 adb are running. Check the current adb:

    which adb
    Expected Output : ANDROID_SDK/platform-tools/adb

Normally the result will be:

    /usr/bin/adb

Delete this older version by:

    cd /urs/bin
    sudo rm adb
查看更多
泪湿衣
5楼-- · 2018-12-31 14:05

I experienced a similar problem where my attempts to use adb such as adb logcat provided this error output:

adb server version (40) doesn't match this client (36); killing...

This solution worked for me in 2018 on Ubuntu 18.04 from Android Studio 3.2.1 using terminal.

The commands are as follows:

adb kill-server sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin/adb sudo chmod +x /usr/bin/adb adb start-server

You may need to adjust the cp command arguments based on the path to Android/ on your system.

2nd generation kudos to my source: https://stackoverflow.com/a/40991118/7015599

查看更多
琉璃瓶的回忆
6楼-- · 2018-12-31 14:08

This is caused because you are running a adb other than the one included in the SDK. If on linux check where is the adb binary located

which adb
Expected Output : ANDROID_SDK/platform-tools/adb

If not pointing to ANDROID_SDK/platform-tools/adb then you are running some old version of adb installed on a different location on the machine.

Nothing wrong running adb other than the one provided with SDK but the downside is it is not updated automatically when the android SDK is updated and that's why you running into this out-dated version issue.

The easier fix and to avoid this issue in future rename the older (misleading) adb binary file to something else.

Follow the steps to resolve this issue.

$ which adb
*o/p /usr/bin/adb  -   (output will depend on your machine)*
$ cd /usr/bin/
$ ls -lt | grep adb
*o/p -rwxr-xr-x 1 root   root      160912 Mar 31  2016 adb*
$ sudo mv adb adb_bakup
$ ls -lt | grep adb
o/p -rwxr-xr-x 1 root   root      160912 Mar 31  2016 adb_bakup
$ export PATH="/path/to/android_sdk/platform-tools:$PATH"
$ which adb  
*o/p <your android sdk dir>/platform-tools/adb*   ---> You are all good now
查看更多
不再属于我。
7楼-- · 2018-12-31 14:08

I went through all the answers on SO and it didn't work for me. When I killed the adb.exe process from Task Manager, it kept reopening it and the reason was that Droid Explorer was working in the background.

Killing the DE process via Task Manager and then killing adb.exe (and running it again from the console through 'adb start-server' worked for me.

This can be useful for many people who have rooted their devices.

查看更多
登录 后发表回答