Android Studio - Lollipop、ADB 和 Genymotion 问题:设备不会显示。“adb服务器过时了。杀了……”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26431972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:24:40  来源:igfitidea点击:

Android Studio - Lollipop, ADB, & Genymotion issues: Devices won't show up. "adb server is out of date. killing..."

androidadbgenymotionandroid-5.0-lollipop

提问by loeschg



Update (11/10/14): Genymotion has released 2.3.1 which fixes this issue. https://cloud.genymotion.com/page/changelog/#231

更新 (11/10/14):Genymotion 发布了 2.3.1,修复了这个问题。https://cloud.genymotion.com/page/changelog/#231



Update (10/21/14): Genymotion replied to my support email and indicated the solution recommended by @plackemacher below is the suggested fix at the moment. They are aware of the issue.

更新(2014 年 10 月 21 日):Genymotion 回复了我的支持电子邮件,并指出下面@plackemacher 推荐的解决方案是目前建议的解决方案。他们知道这个问题。



Since upgrading to Lollipop, I'm having adb issues when using a Genymotion emulator. Devices don't show up in Android Studio, and I've also gotten the following error when trying to run adb devices:

升级到 Lollipop 后,我在使用 Genymotion 模拟器时遇到了 adb 问题。设备未显示在 Android Studio 中,我在尝试运行时也收到以下错误adb devices

$ adb devices

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

I'm not sure if it's because of the Lollipop upgrade or coincidence.

我不确定是因为 Lollipop 升级还是巧合。

Edit/update:

编辑/更新

Per Chris Satton's comment, I investigated if multiple adb processes were running (ps aux | grep adb), and it looks like it's a Genymotion conflict(?). It looks to include its own version of adb.

根据 Chris Satton 的评论,我调查了是否有多个 adb 进程正在运行 ( ps aux | grep adb),它看起来像是 Genymotion 冲突 (?)。它看起来包括它自己的 adb 版本。

greg 72550 0.0 0.0 611164 1508 ?? S 4:14PM
0:00.02 /Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS/tools/adb -s 192.168.56.102:5555 shell

greg 72523 0.0 0.0 635956 2296 ?? S 4:14PM 0:00.02 adb -P 5037 fork-server server

greg 72550 0.0 0.0 611164 1508 ?? S 4:14PM
0:00.02 /Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS/tools/adb -s 192.168.56.102:5555 shell

greg 72523 0.0 0.0 635956 2296 ?? S 4:14PM 0:00.02 adb -P 5037 fork-server 服务器

回答by plackemacher

Try running this:

尝试运行这个:

killall -9 adb

That should remove all running traces of the daemon

这应该删除守护进程的所有运行痕迹

Edit: Best solution below

编辑:下面的最佳解决方案

This issue may be adbincompatibility with the newest version of the platform SDK. The best solution for this issue with Genymotion is to set the Android SDK within Genymotion to your location. This can be found within the Settings page.

此问题可能adb与最新版本的平台 SDK 不兼容。Genymotion 解决此问题的最佳解决方案是将 Genymotion 中的 Android SDK 设置为您的位置。这可以在“设置”页面中找到。

Genymotion Settings window

Genymotion 设置窗口

回答by CROSP

In my case the problem was that I have installed adb tools and fastboot using this command

就我而言,问题是我使用此命令安装了 adb 工具和 fastboot

sudo apt-get install android-tools-adb android-tools-fastboot

From repository, so in this case this executables goes to the /usr/bin/directory in order that you can use it system-wide ($PATHvariable).

从存储库,所以在这种情况下,这个可执行文件转到/usr/bin/目录,以便您可以在系统范围内使用它($PATH变量)。

In addition, I am running android studio with genymotion configured like in the answer above.

此外,我正在运行 android studio,上面的答案配置了 genymotion。

So when I was trying to acces adb (adb shellin my case) it was trying to start another copy of adb process (server) and bind to default port, so the problem was here.

因此,当我尝试访问 adb(adb shell在我的情况下)时,它试图启动 adb 进程(服务器)的另一个副本并绑定到默认端口,所以问题就在这里。

I have just uninstalled the android-tools-adb android-tools-fastbootand added the path to my Android SDKto the $PATHvariable

我刚刚卸载了android-tools-adb android-tools-fastboot并将路径添加到我Android SDK$PATH变量中

回答by Dylan Pierce

Using genymotion on ubuntu.

在 ubuntu 上使用 genymotion。

My solution was to actually use the binary instead of the PATH'd adb.

我的解决方案是实际使用二进制文件而不是 PATH 的 adb。

~/genymotion/tools/abd reboot

~/genymotion/tools/abd reboot

Also I have the custom SDK in genymotion.

此外,我在 genymotion 中有自定义 SDK。

回答by Akash Agarwal

What worked for me finally and what I think is hastle free is that you simply run the adb commands directly from platform-toolsfolder. For example, use ./adb devicesto view the devices. I also changed genymotion's SDK to android's default SDK but I'm not sure if it won't work without doing that.

最终对我有用并且我认为无忧无虑的是您只需直接从platform-tools文件夹中运行 adb 命令。例如,用于./adb devices查看设备。我还将 genymotion 的 SDK 更改为 android 的默认 SDK,但我不确定如果不这样做它是否无法工作。

回答by Bachiri Taoufiq Abderrahman

I think ,if you want to use adbits better to use android studio emulator and test what you want, after you can use Genymotion

我认为,如果你想使用adb,最好使用 android studio 模拟器并测试你想要的,在你可以使用 Genymotion 之后

回答by Ryan

The accepted answer did not work for me, although the idea did, just with a different command:

接受的答案对我不起作用,尽管这个想法对我有用,只是使用了不同的命令:

pkill adb

I'm running ubuntu MATE 1.8.2 and Genymotion 2.6.

我正在运行 ubuntu MATE 1.8.2 和 Genymotion 2.6。

回答by Alex Shcherbyna

None of solutions helped for Ubuntu. Just drag .apk file onto Genymotion device's screen and app will be installed.

没有任何解决方案对 Ubuntu 有帮助。只需将 .apk 文件拖到 Genymotion 设备的屏幕上即可安装应用程序。

Ubuntu 15.04, Genymotion 2.5.2

Ubuntu 15.04,Genymotion 2.5.2

回答by x-ray

Add the Android SDK to the $PATHvariable.

将 Android SDK 添加到$PATH变量中。

回答by Lichblitz

I just used ./adb reboot on Android/Sdk/platform-tools/

我刚刚在 Android/Sdk/platform-tools/ 上使用了 ./adb reboot