简体   繁体   English

ddms: 'adb.exe,start-server' 失败——必要时手动运行,Android Studio

[英]ddms: 'adb.exe,start-server' failed -- run manually if necessary, Android Studio

My adb is down, no matter I am using ADT or Android Studio.我的 adb 已关闭,无论我使用的是 ADT 还是 Android Studio。

And according to the second answer of this SO question , I did:根据这个 SO question的第二个答案,我做了:

  1. I type:我输入:

     adb nodaemon server

    Output: Output:

     cannot bind 'tcp:5037'
  2. Then netstat -ano | findstr 5037然后netstat -ano | findstr 5037 netstat -ano | findstr 5037

    I did find a pid of 7416 who listen in 127.0.0.1:5037我确实找到了一个 7416 的 pid,他在127.0.0.1:5037中收听

  3. I use taskkill /pid 7416 -f to kill it.我使用taskkill /pid 7416 -f来杀死它。

  4. I type netstat -ano | findstr 5037我输入netstat -ano | findstr 5037 netstat -ano | findstr 5037 again, I found another pid listens at 127.0.0.1:5037 again!再次找到netstat -ano | findstr 5037 ,我发现另一个 pid 再次在127.0.0.1:5037侦听!

I guess they are the same, but I have no idea who it is.我猜他们是同一个人,但我不知道是谁。

Can I simply have a easy way to release this port or change the adb port to another one?我可以简单地有一种简单的方法来释放此端口或将 adb 端口更改为另一个端口吗?

In my case I was trying to use genymotion emulator device. 在我的情况下,我试图使用genymotion模拟器设备。 With genymotion opened and running, I've tried to run my app in this emulator but I it doesn't worth 随着genymotion的开启和运行,我试图在这个模拟器中运行我的应用程序,但我不值得

In this part I had this error: 在这部分我有这个错误:

'C:\Users\Jose\AppData\Local\Android\sdk\platform-tools\adb.exe,start-server' failed -- run manually if necessary

Then I've tried Jaskey's solution but it doesn't works. 然后我尝试了Jaskey的解决方案,但它不起作用。

So I stopped genymotion emulator. 所以我停止了genymotion模拟器。 Then I restart ADB (Tools > Android > Unchecked Unable ADB Integration then I've checked again) 然后我重新启动ADB(工具> Android>未经检查的无法ADB集成,然后我再次检查)

Next I've start genymotion emulator again And now the app works on the emulator. 接下来我再次启动genymotion模拟器现在该应用程序可以在模拟器上运行。

Sometimes there are conflicts between ADB Genymotion and ADB SDK because both of them use the same port. 有时ADB Genymotion和ADB SDK之间存在冲突,因为它们都使用相同的端口。 So I recommend always set up ADB Genymotion to use the ADB SDK, in that way to avoid incompatible issues. 因此,我建议始终设置ADB Genymotion以使用ADB SDK,以避免不兼容的问题。

Genymotion-> Settings -> ADB -> Use custom Android SDK tools (here your set up your sdk android location). Genymotion->设置 - > ADB - >使用自定义Android SDK工具(在这里设置你的sdk android位置)。 在此输入图像描述

For Windows, 对于Windows,

Close Android Studio and any of your Emulators you are using, 关闭Android Studio以及您正在使用的任何仿真器,

then goto->TaskManager and Kill the process(adb.exe) 然后转到 - > TaskManager并杀死进程(adb.exe)

After finishing all these First open Android studio followed by emulators. 完成所有这些首先打开的Android工作室,然后是模拟器。

I solve this problem at last! 我终于解决了这个问题! I finally found the program name of the pid and I kill it in the task manager. 我终于找到了pid的程序名,我在任务管理器中将其删除。

The way to detect is described in the question: 问题中描述了检测方法:

  1. adb nodaemon server adb nodaemon服务器

Output: 输出:

cannot bind 'tcp:5037' 无法绑定'tcp:5037'

2.and then netstat -ano | findstr 5037 2.然后是netstat -ano | findstr 5037 netstat -ano | findstr 5037 to find who takes this port. netstat -ano | findstr 5037找到谁接受这个端口。

Get the pid and find it in the task manager. 获取pid并在任务管理器中找到它。 Please note that the process tab may not show the column of pid, we should include it by setting. 请注意,进程选项卡可能不会显示pid列,我们应该通过设置包含它。

In my case, it is tfadb.exe who takes this port! 在我的情况下,是tfadb.exe谁采取这个端口! This is a Chinese Video program client! 这是一个中国视频节目客户端! Try to kill it in task manager. 尝试在任务管理器中杀死它。

Now I stop it starting from booting. 现在我从启动开始停止它。 The problem is solved. 问题已经解决了。

I solved by End task "adb.exe" background process from task manager. 我通过任务管理器的End任务“adb.exe”后台进程解决了这个问题。 and Start adb thats it :) 并开始adb就是这样:)

打开Android工作室后打开Genymotion模拟器。

Just goto the task manager on your PC, and kill adb.exe, then back to your android studio. 只需转到PC上的任务管理器,然后杀死adb.exe,然后再回到你的android工作室。 it should initialize and reconnect. 它应该初始化并重新连接。

in my case one application on window use adb.exe. 在我的情况下,窗口上的一个应用程序使用adb.exe。

that application name is mobogenie. 该应用程序名称是mobogenie。

Fixed :: Goto Window TaskManager select adb.exe and press End process 修复::转到窗口任务管理器选择adb.exe并按结束进程

disconnect any usb connected android devices. 断开连接任何USB连接的Android设备。 I was tethering to my laptop via my cellphone for internet connection. 我通过手机连接我的笔记本电脑进行互联网连接。 I got the adb start server failed error with loopback error "port is only used for one socket connection". 我得到adb启动服务器失败错误,环回错误“端口仅用于一个套接字连接”。

I disconnected my cellphone usb connection from my laptop and now android studio recognizes my genymotion emulator and another android device I have connected via usb in the deployment target box. 我从我的笔记本电脑断开了我的手机usb连接,现在android studio识别我的genymotion模拟器和我在部署目标盒中通过usb连接的另一个Android设备。

Close Android studio then go to Task Manager 关闭Android工作室然后转到Task Manager

  • End Task adb.exe End Task adb.exe
  • goto Details menu 转到详细信息菜单
    • End Task java.exe and jusched.exe End Task java.exe和jusched.exe

now open Android Studio it will work properly 现在打开Android Studio它会正常工作

The best and working solution is:最好的和有效的解决方案是:

  1. Close Android Studio关闭 Android Studio
  2. Open task manager打开任务管理器
  3. Kill the process adb.exe杀死进程adb.exe
  4. Open android studio again再次打开android studio
  5. Problem solved问题解决了

如果genymotion或模拟器不工作尝试在您的系统中安装pdanet +并且移动设备选择您的移动类型(motorola,sony,other),它将自动安装驱动程序并在移动设备中运行您的应用程序。

Check the firewall of the system. 检查系统的防火墙。 May be the "allow app to communicate through windows firewall" may have blocked android studio. 可能是“允许应用程序通过Windows防火墙进行通信”可能已经阻止了android工作室。

I have tried all of the solutions proposed above, but no one of them solve my problem.我已经尝试了上面提出的所有解决方案,但没有一个能解决我的问题。 I had some hour of hadaches trying to solve this problem on my laptop (Ubuntu 20.04).我花了几个小时试图在我的笔记本电脑(Ubuntu 20.04)上解决这个问题。 This is how I came to solve it finally.这就是我最终解决它的方式。

The problem was that the adb default port 5037 was already taken by another, so the solution became simple:问题是 adb 默认端口 5037 已经被别人占用了,所以解决方案就变得简单了:

  1. kill the process running on that port (5037) then launch the adb manually终止在该端口 (5037) 上运行的进程,然后手动启动 adb

  2. launch the adb on another port:在另一个端口启动 adb:

    user~$ adb start-server -P xxxx用户~$ adb start-server -P xxxx

    Where xxxx represent another port其中 xxxx 代表另一个端口

There may be a problem with Windows 11. to solve that issue follow the steps Windows 可能有问题 11. 要解决该问题,请按照以下步骤操作

Go to the android studio app Right-click the app Go to Properties Go to compatibility Check the Run this program in compatibility mode Select windows version 10 or 8 or 7 Then apply and ok Go 到 android studio app 右击应用程序 Go 到 Properties Go 到 compatibility 勾选 Run this program in compatibility mode Select windows version 10 or 8 or 7 然后 apply and ok

After these changes start the Android Studio App, This is works for me.这些更改后启动 Android Studio 应用程序,这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM