在Mac上进行Android开发时,我的这部新手机并没有出现在adb的设备列表中。很多其他的手机和设备对我来说都很好,所以我知道我的设置是好的。
我在手机上启用了调试(设置—>应用程序—>开发—> USB调试),但当我运行adb设备时,它不显示
在Mac上进行Android开发时,我的这部新手机并没有出现在adb的设备列表中。很多其他的手机和设备对我来说都很好,所以我知道我的设置是好的。
我在手机上启用了调试(设置—>应用程序—>开发—> USB调试),但当我运行adb设备时,它不显示
当前回答
重要更新:正如@equiman指出的,有一些USB电缆只用于充电,不传输数据。有时交换电缆也会有帮助。
更新一些版本的adb, ~/.android/adb_usb.ini必须被删除。
执行摘要:将Vendor ID添加到~/.android/adb_usb.ini并重新启动adb
详情: 大多数情况下,不需要做任何事情就可以让Mac识别手机/设备。说真的,99%的情况下“它就是管用”。
也就是说,重置adb的最快方法是按顺序使用以下命令重新启动它:
adb kill-server
adb devices
但是adb devices命令时常找不到您的设备。也许如果你正在使用一些实验性的或原型的或不寻常的设备,也许它只是未知的,不会出现。
您可以通过告诉adb您的设备的“Vendor ID”来帮助adb找到您的设备,这实际上是为它提供了一个提示。这可以通过将十六进制供应商ID放在文件~/.android/adb_usb.ini中来实现
但是首先您必须找到Vendor ID值。幸运的是,在Mac上这很简单。启动系统信息应用程序。它位于/Applications/Utilities/文件夹中,或者你可以通过屏幕左上角的苹果菜单找到它,选择“关于这台Mac”,然后点击“更多信息…”按钮。截图如下:
Expand the "Hardware" tree, select "USB", then look for your target device. In the above example, my device is named "SomeDevice" (I did that in photoshop to hide the real device manufacturer). Another example would be a Samsung tablet which shows up as "SAMSUNG_Android" (btw, I didn't have to do anything special to make the Samsung tablet work.) Anyway, click your device and the full details will display in the pane below. This is where it lists the Vendor ID. In my example from the screenshot the value is 0x9d17 -- use this value in the next command
echo 0x9d17 >> ~/.android/adb_usb.ini
在此之前,如果你还没有adb_usb.ini文件,这也没关系,大多数情况下,它只是不需要找到你的设备,所以该文件不存在是很正常的。上面的命令将创建它,如果它已经存在,则将它附加到它的底部。现在运行上面列出的命令重新启动adb,您应该可以开始了。
adb kill-server ; adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
123ABC456DEF001 device
其他回答
除了红米Note 4中的USB调试外,我还必须启用USB调试(安全设置)开发人员选项。
信不信由你,换USB线帮我解决了这个问题。我一直在用一个随机的Android设备(它不起作用),但当我换到一个真正的Android设备上时,它就起作用了。
另一个好的电缆起作用的迹象是,Android文件传输应用程序立即上线,而蹩脚的电缆却没有做到这一点。
如果你像我一样尝试了所有其他的答案,但都没有运气,那么还有一件事可以尝试。
以我为例(Android 4.3),我在通知下进入USB设置,从MTP模式(媒体设备)切换到PTP模式(相机),一旦切换,设备就出现在ADT设备列表中。
重要更新:正如@equiman指出的,有一些USB电缆只用于充电,不传输数据。有时交换电缆也会有帮助。
更新一些版本的adb, ~/.android/adb_usb.ini必须被删除。
执行摘要:将Vendor ID添加到~/.android/adb_usb.ini并重新启动adb
详情: 大多数情况下,不需要做任何事情就可以让Mac识别手机/设备。说真的,99%的情况下“它就是管用”。
也就是说,重置adb的最快方法是按顺序使用以下命令重新启动它:
adb kill-server
adb devices
但是adb devices命令时常找不到您的设备。也许如果你正在使用一些实验性的或原型的或不寻常的设备,也许它只是未知的,不会出现。
您可以通过告诉adb您的设备的“Vendor ID”来帮助adb找到您的设备,这实际上是为它提供了一个提示。这可以通过将十六进制供应商ID放在文件~/.android/adb_usb.ini中来实现
但是首先您必须找到Vendor ID值。幸运的是,在Mac上这很简单。启动系统信息应用程序。它位于/Applications/Utilities/文件夹中,或者你可以通过屏幕左上角的苹果菜单找到它,选择“关于这台Mac”,然后点击“更多信息…”按钮。截图如下:
Expand the "Hardware" tree, select "USB", then look for your target device. In the above example, my device is named "SomeDevice" (I did that in photoshop to hide the real device manufacturer). Another example would be a Samsung tablet which shows up as "SAMSUNG_Android" (btw, I didn't have to do anything special to make the Samsung tablet work.) Anyway, click your device and the full details will display in the pane below. This is where it lists the Vendor ID. In my example from the screenshot the value is 0x9d17 -- use this value in the next command
echo 0x9d17 >> ~/.android/adb_usb.ini
在此之前,如果你还没有adb_usb.ini文件,这也没关系,大多数情况下,它只是不需要找到你的设备,所以该文件不存在是很正常的。上面的命令将创建它,如果它已经存在,则将它附加到它的底部。现在运行上面列出的命令重新启动adb,您应该可以开始了。
adb kill-server ; adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
123ABC456DEF001 device
此外,确保你在供应商的网站上查看他们的“USB”驱动程序。我的AT&T Galaxy Note(运行Android 2.3.6)遇到了这个问题,如果没有从三星网站上获得的驱动程序安装,adb无法识别。