Android:Adb 拒绝连接到客户端

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23794089/
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 07:27:44  来源:igfitidea点击:

Android: Adb rejected connection to client

androidshelldebuggingintellij-ideaadb

提问by Rosenpin

I was trying to install an app on my nexus 5 from intellij and for the first time i get an error saying

我试图从 intellij 在我的 nexus 5 上安装一个应用程序,这是我第一次收到错误消息

"DeviceMonitor: Adb rejected connection to client '5081': closed" 

I tried restart my adb restart computer, disable, enable android debugging sync gradle. The weird thing is that when i try running it on a virtual device it works. Anyone has an idea? Here is the full error code :

我尝试重新启动我的 adb 重新启动计算机,禁用,启用 android 调试同步 gradle。奇怪的是,当我尝试在虚拟设备上运行它时,它可以工作。有人有想法吗?这是完整的错误代码:

DeviceMonitor: Adb rejected connection to client '5081': closed DeviceMonitor: Adb rejected connection to client '5064': closed DeviceMonitor: Adb rejected connection to client '4962': closed DeviceMonitor: Adb rejected connection to client '5081': closed DeviceMonitor: Adb rejected connection to client '5064': closed DeviceMonitor: Adb rejected connection to client '5064': closed DeviceMonitor: Adb rejected connection to client '3483': closed DeviceMonitor: Adb rejected connection to client '3483': closed

DeviceMonitor:Adb 拒绝连接到客户端“5081”:关闭 DeviceMonitor:Adb 拒绝连接到客户端“5064”:关闭 DeviceMonitor:Adb 拒绝连接到客户端“4962”:关闭 DeviceMonitor:Adb 拒绝连接到客户端“5081”:关闭 DeviceMonitor: Adb 拒绝连接到客户端“5064”:关闭 DeviceMonitor:Adb 拒绝连接到客户端“5064”:关闭 DeviceMonitor:Adb 拒绝连接到客户端“3483”:关闭 DeviceMonitor:Adb 拒绝连接到客户端“3483”:关闭

logcat shows nothing, i tried running it in terminal "adb logcat" and it showed normal either.

logcat 什么也没显示,我尝试在终端“adb logcat”中运行它,它也显示正常。

回答by Alex Lowe

I just had this issue, and Googling didn't yield a ton of results when I looked it up. Alchete's answer was what solved this issue for me, but being new to the Windows command line, I didn't know how to execute it. So I just want to elaborate in case anyone is in the same boat as I was.

我刚刚遇到了这个问题,当我查找时,谷歌搜索并没有产生大量结果。Alchete 的回答为我解决了这个问题,但是作为 Windows 命令行的新手,我不知道如何执行它。所以我只想详细说明,以防有人和我在同一条船上。

Open the Start Menu and type cmd to get to the command line.

打开“开始”菜单并键入 cmd 以进入命令行。

Change directories to get to the sdk folder that contains the adb.exe file.

更改目录以访问包含 adb.exe 文件的 sdk 文件夹。

For me the command looked like this:

对我来说,命令如下所示:

cd Documents\Programming\android-studio\sdk\platform-tools

Adjust based on the path to your sdk folder.

根据 sdk 文件夹的路径进行调整。

Then, you can enter:

然后,您可以输入:

adb kill-server

Followed by:

其次是:

adb start-server 

回答by Alchete

I just had this problem as well. Closing and re-launching Android Studio had no effect.

我也刚遇到这个问题。关闭并重新启动 Android Studio 没有任何效果。

The solution for me was to execute the following commands in a terminal window:

我的解决方案是在终端窗口中执行以下命令:

adb kill-server

adb start-server

After that, my Android device connected as normal.

之后,我的 Android 设备正常连接。

回答by B_Mahoney

My reputation is not high enough, but I wanted to respond to say that Alex Lowe's and Alchete's answer worked for me, combined with andy boot's answer. (+1 to Alex Lowe for the detailed response).

我的声誉不够高,但我想回应说 Alex Lowe 和 Alchete 的回答对我有用,结合 andy boot 的回答。(+1 对 Alex Lowe 的详细回复)。

Furthermore, restart your Android Studio session once you have killed the adb. The server should start right back up again.

此外,杀死 adb 后,重新启动 Android Studio 会话。服务器应该重新启动。

If, like me, you are getting this error because you may have changed intent filters around in your Android Manifest, i.e. you created a Splash Screen and added the Category_Launcher intent

如果像我一样,您收到此错误是因为您可能在 Android 清单中更改了意图过滤器,即您创建了启动画面并添加了 Category_Launcher 意图

For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application

例如,CATEGORY_LAUNCHER 表示它应该作为顶级应用程序出现在启动器中

..then you will want to make sure it is specified as your Launch Activity as previously explained (Run - Edit Configurations - Launch). "Launch default activity will initially be selected, but you want to change that to the new Activity you have specified as your Launcher.

..然后您需要确保将其指定为您的启动活动,如前所述(运行 - 编辑配置 - 启动)。“最初将选择启动默认活动,但您希望将其更改为您指定为启动器的新活动。

Hopefully one of those two solutions will work!

希望这两个解决方案之一会起作用!

Also, if you are having trouble finding the directory path for your Android SDK, go to your SDK Manager in Android Studio and the directory path should be at the top of the dialog box.

此外,如果您无法找到 Android SDK 的目录路径,请转到 Android Studio 中的 SDK 管理器,目录路径应位于对话框顶部。

回答by andy boot

I had the same problem recently.

我最近遇到了同样的问题。

I had moved the intent-filtertag in the AndroidManifest.xmlfile inorder to start a different activity.

我在AndroidManifest.xml文件中移动了Intent-filter标签,以便启动不同的活动。

What I had forgotten to do was change the run/debug target inside Android Studio. Click Run -> Edit configurations. Look at Launchstring and check it matches the activity in AndroidManifest which has the launch XML inside it:

我忘记做的是更改 Android Studio 中的运行/调试目标。单击运行 -> 编辑配置。查看Launch字符串并检查它是否与 AndroidManifest 中的活动匹配,其中包含启动 XML:

Launch XML:

启动 XML:

<intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

回答by Davide

I had the same problem which in my case was due to having erroneously selected wear instead of app (and the watch feature was optional, see e.g. android studio error : missing feature: WATCHfor details). The GUI was stuck in "waiting for phone" forever.

我遇到了同样的问题,在我的情况下,这是由于错误地选择了磨损而不是应用程序(并且手表功能是可选的,请参阅例如android studio error : missing feature: WATCH了解详细信息)。GUI 永远停留在“等待电话”中。