无法通过 ADB 连接到我的 android 设备
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21076992/
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
Unable to connect to my android device via ADB
提问by susparsy
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. I downloaded an adb running application and started ADB.
我的设备已植根。Adb 调试已启用。我下载了一个运行 adb 的应用程序并启动了 ADB。
Now i am trying adb connect ip:5555. and keep on getting "unable to connect to ip:5555" ...
现在我正在尝试 adb connect 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 未授权
回答by Yithirash
Launching Cordova
启动 Cordova
- Open Node.js / CMD
- Point to "the directory where you have located your source folder" >>> C:\Projects\RJX
- Enable Wifi
- Turn on Developer Option under settings
- Enable / Check USB Debugging Option under settings (Google if cannot find this option)
- Enable / Check the MTP Option under settings (Google if cannot find this option)
- 打开 Node.js/CMD
- 指向“您所在的源文件夹所在的目录”>>> C:\Projects\RJX
- 启用 Wifi
- 在设置下打开开发者选项
- 在设置下启用/检查 USB 调试选项(如果找不到此选项,请谷歌)
- 启用/检查设置下的 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. Sometimes it needs some refresh. **Android devices version 4.0.4 and after should be no problem if you follow these steps.
如果此步骤不起作用,请尝试关闭 cmd 并再次执行。有时它需要一些刷新。**Android 设备 4.0.4 及以后版本应该没有问题,如果您按照这些步骤操作。
回答by user26676
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. If it looks like this pic it's that you're notrunning 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. instead run/download/update this(with phone disconnected) then make sure Kies is happy AND MAKE SUREMTU is enabled
检查您的手机是否在 Windows 中仅作为“相机” - 转到“我的电脑”并查看。如果看起来像这张照片,那是因为你没有运行Samsung Kies
(/禁用,因为它很烦人)当你插入手机时,它仍然会“闪烁”,它可能是通过 wifi 连接的,所以有一个 LAN ip 但它不是真的“连接”到你的电脑。而不是运行/下载/更新本(与手机断开),然后确保Kies的是快乐,确保MTU启用
回答by Marian Pa?dzioch
This error happened to me when PC was (accidentally) NOT in the same network as Android. When I logged on Android to the same WIFI network as PC it now works perfect and I don't have this problem.
当 PC(意外地)与 Android 不在同一个网络中时,我就发生了这个错误。当我将 Android 登录到与 PC 相同的 WIFI 网络时,它现在运行良好,我没有这个问题。
回答by Fiddy Bux
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, e.g.:
在此之后,您的 adb connect 应该可以正常工作,例如:
adb connect 192.168.0.n
Hope this fixes it for you.
希望这可以为您解决。