无法使用“adb devices”找到 Android 设备命令

发布于 2024-11-08 05:06:27 字数 433 浏览 4 评论 0原文

我正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(16

眼中杀气 2024-11-15 05:06:27

我知道这个线程很旧,但我认为这仍然有帮助。几乎所有时候它都能在 OS X 上“正常工作”,但有时新的/原型的或不知名的设备不会被识别。尝试通过以下步骤来帮助解决问题(我现在不在 Mac 附近,但我昨晚执行了此操作并且我想我记得):

  1. 打开系统分析器并在 USB 上找到该设备。查看其详细信息以查找供应商 ID。例如,摩托罗拉设备将显示 0x2bb8。或者只是通过 Google 查找您的供应商的硬件 ID。

    如果没有显示任何内容,请务必尝试不同的电缆。如果您有有效的电缆,Android 文件传输非常适合检测设备。

  2. 编辑 ~/.android/adb_usb.ini 以包含该供应商 ID。如果该文件不存在,则仅使用该行创建它。

  3. 重启亚行

    adb Kill-server 
    adb 启动服务器
    
  4. 也许拔出/插入您的手机。

希望您能看到您的设备。

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):

  1. 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.

  2. Edit ~/.android/adb_usb.ini to include that Vendor ID. If the file doesn't exist, create it with that line only.

  3. Restart ADB

    adb kill-server 
    adb start-server
    
  4. Maybe unplug/plugin your phone.

And hopefully you see your device.

旧时模样 2024-11-15 05:06:27

您是否有可能在连接到 Mac 时也使用 EasyTether 应用程序?如果您碰巧使用此应用程序,那么您很幸运,因为解决方案是

sudo kextunload -v /System/Library/Extensions/EasyTetherUSBEthernet.kext

从终端 调用:我忘记你是否需要重新启动。

这将禁用网络共享,但您现在可以通过 adb 查看您的设备。

要在完成调试后重新启用网络共享,请使用

sudo kextload -v /System/Library/Extensions/EasyTetherUSBEthernet.kext

当然,如果您不使用 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:

sudo kextunload -v /System/Library/Extensions/EasyTetherUSBEthernet.kext

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

sudo kextload -v /System/Library/Extensions/EasyTetherUSBEthernet.kext

Of course, if you're not using EasyTether, then hopefully someone else has an idea....

大海や 2024-11-15 05:06:27

这里同样的问题。 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.

情话难免假 2024-11-15 05:06:27

如果您在使用 Lollipop (Android 5.*) 时遇到这样的问题,也许你们应该执行一个简单的步骤,就像我在 ADB(我使用 Ubuntu)拿到我的手机之前所做的那样:

将 USB PC 连接类型更改为“发送”图片(PTP)"
(在我使用“媒体设备(MTP)”之前)

就像这样:

Screenshot

并且不要忘记激活“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:

Screenshot

And don't forget to activate checkbox "USB debugging".

凉世弥音 2024-11-15 05:06:27

今天我遇到了这个问题,手机在连接时正在充电,但 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.

等待圉鍢 2024-11-15 05:06:27

如果您已将设备插入系统,但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 that USB debugging option is checked in the Developer Options tab under Settings. Under Android 4.2.2 and above (from what I have observed), the Developer Options are hidden unless explicitly revealed. To make Developer Options active, tap 7 times on the Settings > About device > Build number. Once done, go back to Settings > Developer Options and activate USB Debugging.

Using adb version 1.0.31, I was able to make the device visible.

聊慰 2024-11-15 05:06:27

从此链接引用!

这仅适用于 Mac!

要使手机对 adb 可见,您需要执行以下操作:

  1. 打开终端 (Applications/Utilities/Terminal)
  2. cd /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/IOUSBCompositeDriver.kext/Contents
  3. sudo nano Info.plist(或 vi、emacs,或您喜欢的任何控制台编辑器)
  4. 复制 IOUSBComposite 部分(来自
  5. 将该部分粘贴到第 66 行(就在它出现的位置之后),以便文件中有 2 个副本
  6. bDeviceSubClass 值从 0 更改2
  7. 将密钥名称从 IOUSBComposite 更改为 GW620

最终结果应如下所示:

                    <key>GW620</key>
                    <dict>
                            <key>CFBundleIdentifier</key>
                            <string>com.apple.driver.AppleUSBComposite</string>
                            <key>IOClass</key>
                            <string>IOUSBCompositeDriver</string>
                            <key>IOProviderClass</key>
                            <string>IOUSBDevice</string>
                            <key>bDeviceClass</key>
                            <integer>0</integer>
                            <key>bDeviceSubClass</key>
                            <integer>2</integer>
                    </dict>

  1. sudo diskutil Repairpermissions / 并让它完成
  2. sudo touch /System/Library/Extensions 并等待几分钟以完成扩展重新索引
  3. 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:

  1. Open terminal (Applications/Utilities/Terminal)
  2. cd /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/IOUSBCompositeDriver.kext/Contents
  3. sudo nano Info.plist (or vi, or emacs, or whatever console editor you prefer)
  4. Copy the IOUSBComposite section (from <key> to </dict>)
  5. Paste the section in at line 66 (right after where it appears) so you have 2 copies in the file
  6. Change the bDeviceSubClass value from 0 to 2
  7. Change the key name from IOUSBComposite to GW620

The end result should look something like this:

                    <key>GW620</key>
                    <dict>
                            <key>CFBundleIdentifier</key>
                            <string>com.apple.driver.AppleUSBComposite</string>
                            <key>IOClass</key>
                            <string>IOUSBCompositeDriver</string>
                            <key>IOProviderClass</key>
                            <string>IOUSBDevice</string>
                            <key>bDeviceClass</key>
                            <integer>0</integer>
                            <key>bDeviceSubClass</key>
                            <integer>2</integer>
                    </dict>

  1. sudo diskutil repairpermissions / and let it finish
  2. sudo touch /System/Library/Extensions and wait a few mins for the extension reindexing to finish
  3. adb devices should now see your phone

Note, 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

强者自强 2024-11-15 05:06:27

我遇到了这个问题。事实证明,我的解决办法是更换我连接的 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.

冷了相思 2024-11-15 05:06:27

如果在 Mac OS X 上使用adb devices,则不会显示任何设备,当然,您已在设备上启用了USB 调试(请参阅< a href="http://developer.android.com/tools/device.html" rel="noreferrer">http://developer.android.com/tools/device.html),然后尝试:

$ android update adb
adb has been updated. You must restart adb with the following commands
    adb kill-server
    adb start-server

然后:

$ adb kill-server
$ adb start-server
* daemon not running. starting it now on port ... *
* daemon started successfully *

最后:

$ adb devices
List of devices attached 
......  device

您的设备现在应该在列表中。

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:

$ android update adb
adb has been updated. You must restart adb with the following commands
    adb kill-server
    adb start-server

Then:

$ adb kill-server
$ adb start-server
* daemon not running. starting it now on port ... *
* daemon started successfully *

And finally:

$ adb devices
List of devices attached 
......  device

Your device should be now in the list.

極樂鬼 2024-11-15 05:06:27

在 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 run android adb update for the devices to be detected.

南城旧梦 2024-11-15 05:06:27

确保您的设备上的 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.

轻拂→两袖风尘 2024-11-15 05:06:27

重新启动 adb 服务器对我来说适用,在模拟器、vmwware 和虚拟机中

adb kill-server
adb start-server

如果您使用的是虚拟机,请确保您分配了一个 IP:

Alt + 1
type: netcfg

返回:

Alt + 7

如果有:

 eth0: DOWN 0.0.0.0/XX

更改您的配置to:

NAT or BRIDGE

重新启动虚拟机和服务器,然后重试。

如果您使用的是手机或平板电脑:

  • 拔掉您的设备

  • 稍等片刻,然后重新插入

  • 并重新启动adb服务器

希望这对您有帮助

restart the adb server works for me, in emulator, vmwware and virtual

adb kill-server
adb start-server

if you´re using a virtual machine, make sure you have an IP assigned with:

Alt + 1
type: netcfg

to go back:

Alt + 7

if you have:

 eth0: DOWN 0.0.0.0/XX

change your configuration to:

NAT or BRIDGE

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

自在安然 2024-11-15 05:06:27

您需要正确安装 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.

迷途知返 2024-11-15 05:06:27

我在 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

爱的十字路口 2024-11-15 05:06:27

仅仅因为您的 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.

国产ˉ祖宗 2024-11-15 05:06:27

我安装了 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文