简体   繁体   English

无法通过 ADB 连接到我的 android 设备

[英]Unable to connect to my android device via ADB

Sorry for the nooby question, I am having trouble sorting this out using the web.很抱歉这个菜鸟问题,我在使用网络解决这个问题时遇到了麻烦。

I am trying to simply connect my device to my pc via adb to debug my application.我试图通过 adb 将我的设备连接到我的电脑来调试我的应用程序。

My device is rooted.我的设备已植根。 Adb debugging is enabled. Adb 调试已启用。 I downloaded an adb running application and started ADB.我下载了一个运行 adb 的应用程序并启动了 ADB。

Now i am trying adb connect ip:5555.现在我正在尝试 adb connect ip:5555。 and keep on getting "unable to connect to ip:5555" ...并继续“无法连接到 ip:5555”...

Same happend when i try to connect via usb.当我尝试通过 USB 连接时也发生了同样的情况。

c:\>adb connect 192.168.20.191:5555
unable to connect to 192.168.20.191:5555

Help...?帮助...?

EDIT: C:>adb devices List of devices attached 06fecaa1 unauthorized编辑:C:>adb devices 连接的设备列表 06fecaa1 未授权

Launching Cordova启动 Cordova

  1. Open Node.js / CMD打开 Node.js/CMD
  2. Point to "the directory where you have located your source folder" >>> C:\\Projects\\RJX指向“您所在的源文件夹所在的目录”>>> C:\\Projects\\RJX
  3. Enable Wifi启用 Wifi
  4. Turn on Developer Option under settings在设置下打开开发者选项
  5. Enable / Check USB Debugging Option under settings (Google if cannot find this option)在设置下启用/检查 USB 调试选项(如果找不到此选项,请谷歌)
  6. Enable / Check the MTP Option under settings (Google if cannot find this option)启用/检查设置下的 MTP 选项(如果找不到此选项,请谷歌)

ADB Commands亚行命令

adb kill-server
adb start-server
//plug off cable from mobile and plug in again if you connected your device earlier
//Uninstall the application from mobile if you already installed. (if necessary)
adb tcpip 5555
adb connect "ip" //adb connect 192.192.2.128
adb devices //to check device details
cordova run android --device

if this steps are not worked, try to close the cmd and do it again.如果此步骤不起作用,请尝试关闭 cmd 并再次执行。 Sometimes it needs some refresh.有时它需要一些刷新。 **Android devices version 4.0.4 and after should be no problem if you follow these steps. **Android 设备 4.0.4 及以后版本应该没有问题,如果您按照这些步骤操作。

I will assume you are able to understand adb connect / ip's etc I won't bore you with that我假设你能够理解 adb connect/ip 等我不会让你厌烦的

but there are two lame "gotcha's"但有两个蹩脚的“陷阱”

THE GENYMOTION GOTCHA GENYMOTION GOTCHA

genymotion WRECKS a lot of this sometimes.. I am sorry but it does.. it has a "I know what I am doing I am taking over" mentality.. sadly it doesn't know what it's doing :-P often you have to turn off genymotion for the adb->usb to work.. basically connect phone FIRST ... make sure it's there in eclipse (adb kill-server / start server if needs be ), then AND ONLY THEN then genymotion AFTER genymotion 有时会破坏很多这样的东西......我很抱歉,但它确实......它有一种“我知道我在做什么我正在接管”的心态......遗憾的是它不知道它在做什么:-P经常你有关闭 genymotion 使 adb->usb 工作.. 基本上首先连接手机......确保它在 eclipse 中(如果需要,adb kill-server / start server),然后然后才在 genymotion 之后

THE OOPS [/facepalm] GOTCHA哎呀[/facepalm] GOTCHA

check that your phone it isn't in Windows merely as a "Camera" - go to My Computer and look.检查您的手机是否在 Windows 中仅作为“相机” - 转到“我的电脑”并查看。 If it looks like this pic it's that you're not running Samsung Kies (/disabled because it's annoying) the phone still goes "blub bling" when you plug it in, it may be connected via wifi so have a LAN ip but it is NOT really "connected" to ur PC.如果看起来像这张照片,那是因为你没有运行Samsung Kies (/禁用,因为它很烦人)当你插入手机时,它仍然会“闪烁”,它可能是通过 wifi 连接的,所以有一个 LAN ip 但它是没有真正“连接”到你的电脑。在此处输入图片说明 instead run/download/update this (with phone disconnected) then make sure Kies is happy AND MAKE SURE MTU is enabled而不是运行/下载/更新本(与手机断开),然后确保Kies的是快乐,确保MTU启用

在此处输入图片说明

在此处输入图片说明

This error happened to me when PC was (accidentally) NOT in the same network as Android.当 PC(意外地)与 Android 不在同一个网络中时,我就发生了这个错误。 When I logged on Android to the same WIFI network as PC it now works perfect and I don't have this problem.当我将 Android 登录到与 PC 相同的 WIFI 网络时,它现在运行良好,我没有这个问题。

The answer here is that it's not listening on the correct (default) port.这里的答案是它没有侦听正确的(默认)端口。 So you need to set the TCP/IP port to 5555. Connect your device via USB and issue the following command in cmd (terminal):因此您需要将 TCP/IP 端口设置为 5555。通过 USB 连接您的设备并在 cmd(终端)中发出以下命令:

adb tcpip 5555

Following this your adb connect should work fine, eg:在此之后,您的 adb connect 应该可以正常工作,例如:

adb connect 192.168.0.n

Hope this fixes it for you.希望这可以为您解决。

This happened when I was previously connected with one device (eg apps2fire ) and then tried using adb command from another machine.当我之前连接到一个设备(例如apps2fire )然后尝试使用另一台机器上的adb命令时,就会发生这种情况。 I rebooted the Android device and then tried again and received the prompt to allow the connection as I would have expected.我重新启动了 Android 设备,然后再次尝试并收到了允许连接的提示,正如我所期望的那样。

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

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