无法使用“adb devices”找到 Android 设备命令
我正在 macOS
上开发 Android
应用程序,并且我的应用程序在模拟器上运行良好。我想在设备上运行它,但是当我运行 adb devices
时,我什么也没得到。
localhost:platform-tools BF$ adb devices
List of devices attached
localhost:platform-tools BF$
我已经检查了有关“设置开发设备”的参考文献中的文档。我已经一步一步做好了一切。
在文档中,有一些文字:设置您的系统以检测您的设备。如果您在 Mac OS X 上进行开发,它就可以正常工作。跳过这一步。
现在,我找不到任何解决方案。 Android 设备需要特殊的驱动程序吗?
I am developing Android
application on macOS
and my application runs well on the emulator. I want to run it on the device, but when I run adb devices
I get nothing.
localhost:platform-tools BF$ adb devices
List of devices attached
localhost:platform-tools BF$
I have checked the documentation in the reference about "Setting up a Device for Development". I have done everything step by step.
In the documentation, there are some words: Setup your system to detect your device. If you're developing on Mac OS X, it just works. Skip this step.
Now, I can't find any solution. Does it need special drivers for Android Devices?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(16)
我知道这个线程很旧,但我认为这仍然有帮助。几乎所有时候它都能在 OS X 上“正常工作”,但有时新的/原型的或不知名的设备不会被识别。尝试通过以下步骤来帮助解决问题(我现在不在 Mac 附近,但我昨晚执行了此操作并且我想我记得):
打开系统分析器并在 USB 上找到该设备。查看其详细信息以查找供应商 ID。例如,摩托罗拉设备将显示 0x2bb8。或者只是通过 Google 查找您的供应商的硬件 ID。
如果没有显示任何内容,请务必尝试不同的电缆。如果您有有效的电缆,Android 文件传输非常适合检测设备。
编辑
~/.android/adb_usb.ini
以包含该供应商 ID。如果该文件不存在,则仅使用该行创建它。重启亚行
也许拔出/插入您的手机。
希望您能看到您的设备。
I know this thread is old, but I think this could still help. Almost all the time "it just works" on OS X, but sometimes new/prototype or obscure devices aren't picked up. Try to help it out with these steps (I'm not near my Mac right now, but I did this last night and think I remember):
Open System Profiler and find the device on USB. View it's details to find the Vendor ID. For example, Motorola devices will show 0x2bb8. Or just Google for your vendor's hardware id.
If nothing shown, make sure to try different cables. Android File Transfer is good for detecting the device if you have a valid cable.
Edit
~/.android/adb_usb.ini
to include that Vendor ID. If the file doesn't exist, create it with that line only.Restart ADB
Maybe unplug/plugin your phone.
And hopefully you see your device.
您是否有可能在连接到 Mac 时也使用 EasyTether 应用程序?如果您碰巧使用此应用程序,那么您很幸运,因为解决方案是
从终端 调用:我忘记你是否需要重新启动。
这将禁用网络共享,但您现在可以通过 adb 查看您的设备。
要在完成调试后重新启用网络共享,请使用
当然,如果您不使用 EasyTether,那么希望其他人有一个想法......
Are you by any chance also using the app EasyTether while connected to your Mac? If you happen to use this app, you're in luck, because the solution is to call:
from a terminal. I forget if you have to reboot or not.
This will disable tethering, but you can now see your device via adb.
To renable tethering once you're done debugging, use
Of course, if you're not using EasyTether, then hopefully someone else has an idea....
这里同样的问题。 osx 10.6.6 和 adb 设备给出
$ ./adb 设备
附加设备列表
...空...
重新启动手机没有帮助;尽管它在启动过程中仅与 adb devices 一起列出了一秒钟。
调试已在 adroidsettings->applications 中打开,
最终使它生效的是:关闭并再次打开调试模式。
Same problem here. osx 10.6.6 and adb devices giving
$ ./adb devices
List of devices attached
...empty....
Rebooting the phone didn;'t help although it was listed with adb devices just for a second during the booting process.
Debugging was turned on in adroidsettings->applications
What finally made it tick: turning debugging mode off and on again.
如果您在使用 Lollipop (Android 5.*) 时遇到这样的问题,也许你们应该执行一个简单的步骤,就像我在 ADB(我使用 Ubuntu)拿到我的手机之前所做的那样:
将 USB PC 连接类型更改为“发送”图片(PTP)"
(在我使用“媒体设备(MTP)”之前)
就像这样:
并且不要忘记激活“USB 调试”复选框。
If you're struggling with such an issue using Lollipop (Android 5.*) probably you guys should do one simple step that I'd done before my ADB (I use Ubuntu) got my phone:
Change USB PC connection type to "Send images(PTP)"
(before I've been using "Media device(MTP)")
Just like this:
And don't forget to activate checkbox "USB debugging".
今天我遇到了这个问题,手机在连接时正在充电,但 Mac 上看不到。原来我用的micro USB线只能充电,不能传输数据。一旦我更换了 USB 电缆,它就开始正常工作。
I had this problem today where the phone was charging when connected, but wasn't seen by the Mac. It turned out the micro USB cable that I was using was for charging only and didn't do data. Once I changed the USB cable it started working fine.
如果您已将设备插入系统,但
adb devices
未列出该设备,则需要确保在开发者选项<中选中
USB调试
选项设置
下的/code>选项卡。在 Android 4.2.2 及更高版本(根据我的观察)下,除非明确显示,否则开发者选项是隐藏的。要激活开发者选项
,请在设置>上点击7次。关于设备>内部版本号
。完成后,返回Settings >开发者选项
并激活USB调试
。使用
adb version 1.0.31
,我能够使设备可见。If
adb devices
does not list the device though you have plugged it in to the system, you need to ensure thatUSB debugging
option is checked in theDeveloper Options
tab underSettings
. Under Android 4.2.2 and above (from what I have observed), theDeveloper Options
are hidden unless explicitly revealed. To makeDeveloper Options
active, tap 7 times on theSettings > About device > Build number
. Once done, go back toSettings > Developer Options
and activateUSB Debugging
.Using
adb version 1.0.31
, I was able to make the device visible.从此链接引用!
这仅适用于 Mac!
要使手机对 adb 可见,您需要执行以下操作:
cd /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/IOUSBCompositeDriver.kext/Contents
sudo nano Info.plist
(或 vi、emacs,或您喜欢的任何控制台编辑器)IOUSBComposite
部分(来自
到)
bDeviceSubClass
值从 0 更改2IOUSBComposite
更改为GW620
最终结果应如下所示:
sudo diskutil Repairpermissions /
并让它完成sudo touch /System/Library/Extensions
并等待几分钟以完成扩展重新索引adb devices
现在应该可以看到您的手机注意,这是非常混乱的,并且可能会破坏每个OSX 会自行更新,但它可以工作。我终于可以不再每次想用手机工作时都重新启动了! :D
Referenced from this link!
THIS IS FOR A MAC ONLY!
Here’s what you need to do to make your phone visible to adb:
cd /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/IOUSBCompositeDriver.kext/Contents
sudo nano Info.plist
(or vi, or emacs, or whatever console editor you prefer)IOUSBComposite
section (from<key>
to</dict>
)bDeviceSubClass
value from 0 to 2IOUSBComposite
toGW620
The end result should look something like this:
sudo diskutil repairpermissions /
and let it finishsudo touch /System/Library/Extensions
and wait a few mins for the extension reindexing to finishadb devices
should now see your phoneNote, this is VERY kludgy, and will probably break every time OSX updates itself, but it works. I can finally stop rebooting every time I want to work on the phone! :D
我遇到了这个问题。事实证明,我的解决办法是更换我连接的 USB 电缆。我转回使用手机附带的数据线,结果成功了。
使用三星 Galaxy Player 和三星 micro USB。
是的。这是非常愚蠢的。
I was having this problem. It turns out my fix was to change the USB cable I was connecting with. I switched back to using the cable that came with the phone and it worked.
Using Samsung Galaxy Player and Samsung micro USB.
Yes. This is incredibly dumb.
如果在 Mac OS X 上使用adb devices,则不会显示任何设备,当然,您已在设备上启用了USB 调试(请参阅< a href="http://developer.android.com/tools/device.html" rel="noreferrer">http://developer.android.com/tools/device.html),然后尝试:
然后:
最后:
您的设备现在应该在列表中。
If using adb devices on Mac OS X no device is displayed and, of course, you have enabled the USB debugging on your device (see http://developer.android.com/tools/device.html), then try with:
Then:
And finally:
Your device should be now in the list.
在 Mac Lion 上:
我只需转到
/path/to/android-sdk/tools
并运行android adb update
即可检测到设备。On Mac Lion :
I just had to go to
/path/to/android-sdk/tools
and runandroid adb update
for the devices to be detected.确保您的设备上的 SDK 包安装了相同/更高的 API 级别。
示例:
我的 Xperia Play 上安装的是 Android 2.3.4。如果我的 Mac 上仅安装了 API 10 (Android 2.3.3),ADB 将无法检测到我的设备。当我安装 SDK 11 (Android 3.0) 时——因为我没有找到任何 2.3.4 的 SDK 包,ADB 工作正常。
希望这对你有帮助。
make sure you have same / higher API level installed on SDK packages with your devices.
example :
I have Android 2.3.4 on my Xperia Play. ADB wouldn't detect my device if theres only API 10 (Android 2.3.3) installed on my Mac. When i installed SDK 11 (Android 3.0) -- since I didn't found any SDK package for 2.3.4, the ADB working fine.
hope this help you.
重新启动 adb 服务器对我来说适用,在模拟器、vmwware 和虚拟机中
如果您使用的是虚拟机,请确保您分配了一个 IP:
返回:
如果有:
更改您的配置to:
重新启动虚拟机和服务器,然后重试。
如果您使用的是手机或平板电脑:
拔掉您的设备
稍等片刻,然后重新插入
并重新启动adb服务器
希望这对您有帮助
restart the adb server works for me, in emulator, vmwware and virtual
if you´re using a virtual machine, make sure you have an IP assigned with:
to go back:
if you have:
change your configuration to:
Restart the virtual machine and server, and tried again.
if you´re using a phone or tablet:
unplug your device
wait a moment and plug it again
and restart the adb server
Hope this help you
您需要正确安装 USB 驱动程序并在设置中启用调试。如果这些不起作用,则您的设备可能有问题。
另请查看此内容。
You will need USB driver installed correctly and have debugging enabled in settings. if these dont work there could be something wrong with your device.
Also see this.
我在 Windows 7 上遇到了同样的问题。碰巧我在使用 USB 网络共享功能的同时尝试使用 adb。有一些解决方法同时进行 USB 系绳和调试
The same problem I had on Windows 7. It happened that I was using USB tethering feature alongwith trying to use adb. There are some workarounds for this Usb tether and debug at the same time
仅仅因为您的 Android 设备处于开发者模式,并不意味着它启用了 USB 调试!进入设置>然后开发者选项启用“USB 调试”,然后您应该会看到您的设备。这是一个很容易被忽视的常见错误。
Just because your Android device is in Developer Mode, doesn't mean it has USB debugging enabled!! Go into Settings > Developer options then enable "USB debugging" and then you should see your device. It's a common mistake that's easily overlooked.
我安装了 Xamarin 并尝试使用 Unity。基本上在任何情况下,您都必须终止可能通过 ADB 与您的设备通信的任何应用程序
I had Xamarin installed and tried to use Unity. Basically in any case you have to kill any application that might be talking to your device through
ADB