Android SDK 无法识别可调试设备

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2981498/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:09:50  来源:igfitidea点击:

Android SDK not recognizing debug-able device

android

提问by Kal Zekdor

I'm new to Android development, and am attempting to run a test application on my actual device. I followed the instructions at http://developer.android.com/guide/developing/device.html(and related links), but the Android Debug Bridge (adb) doesn't recognize my connected device.

我是 Android 开发新手,正在尝试在我的实际设备上运行测试应用程序。我按照http://developer.android.com/guide/developing/device.html(和相关链接)上的说明进行操作,但 Android 调试桥 (adb) 无法识别我连接的设备。

Some quick background info, I'm running WinXP, developing with Eclipse, with a Motorola Droid running Android 2.1 as my physical device.

一些快速的背景信息,我正在运行 WinXP,使用 Eclipse 进行开发,使用运行 Android 2.1 的摩托罗拉 Droid 作为我的物理设备。

An overview of the steps I've taken:

我所采取的步骤的概述:

  1. Installed the Android SDK, downloading all necessary packages.
  2. Enabled USB Debugging on my device.
  3. Connected Device via USB, installing the driver from the SDK folder.
  1. 安装 Android SDK,下载所有必要的包。
  2. 在我的设备上启用 USB 调试。
  3. 通过 USB 连接设备,从 SDK 文件夹安装驱动程序。

I'll stop here (though I continued to setup my application to be debug-able in Eclipse), because I at this point I noticed a problem.

我将就此打住(尽管我继续将我的应用程序设置为可在 Eclipse 中调试),因为此时我注意到了一个问题。

Running "sdk\tools\adb devices" at this point (at least, by my understanding), should list my device as connected. However, running this yields only:

此时运行“sdk\tools\adb devices”(至少,据我所知),应该将我的设备列为已连接。但是,运行它只会产生:

List of devices attached

连接的设备列表

My device recognizes that it's connected to a computer in debug mode, and my computer recognizes the device. However, I can't seem to get the sdk to recognize it. I'll leave out the steps I used to setup Eclipse for debugging on a device, as it doesn't seem relevant to the problem. I'll include them if requested.

我的设备识别出它已连接到处于调试模式的计算机,并且我的计算机识别了该设备。但是,我似乎无法让 sdk 识别它。我将省略我用来设置 Eclipse 以在设备上进行调试的步骤,因为它似乎与问题无关。如果需要,我会将它们包括在内。

If anyone has any ideas, I'd greatly appreciate some assistance. Thanks in advance for your time.

如果有人有任何想法,我将不胜感激。在此先感谢您的时间。

回答by Neil Han

I am using HTC OneS. Eclipse on Ubuntu 12.04. I had the USB debugging enabled. But after plugged in, it doesn't let me deploy. It was recognized as a device: ????... no permissions

我正在使用 HTC OneS。Ubuntu 12.04 上的 Eclipse。我启用了USB调试。但是插入后,它不允许我部署。它被识别为设备:????...没有权限

What solved my issue is the USB device permission. I found my answer here.

解决我的问题的是 USB 设备权限。我在这里找到了答案。

What I did:

我做了什么:

$ sudo vi /etc/udev/rules.d/51-android.rules

I added this 2 lines in the rule file:

我在规则文件中添加了这两行:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0cec", MODE="0666"
SUBSYSTEMS=="usb", SYSFS{product}=="Android Phone", MODE="0666"

My device USB vendor:product is "0bb4:0cec". To find it out, use command >lsusb. Then I unplug/plug my phone. It was recognized.

我的设备 USB 供应商:产品是“0bb4:0cec”。要找到它,请使用命令 >lsusb。然后我拔掉/插入我的手机。它被认出来了。

回答by dan

When I had this issue, I figured out that my phone's USB connection was set to media sync mode. When I switched it to mass storage mode, the hello world program loaded right up. I did this by dragging down the USB icon in the top tool bar of the phone's home page.

当我遇到这个问题时,我发现我手机的 USB 连接被设置为媒体同步模式。当我将其切换到大容量存储模式时,hello world 程序立即加载。我通过拖动手机主页顶部工具栏中的 USB 图标来完成此操作。

回答by Mxyk

What usually works for me:

通常对我有用的方法:

  • Unplug device
  • Run ./adb wait-for-devicein terminal in your android-sdk platform-tools
  • Connect device
  • Turn on device
  • 拔下设备
  • ./adb wait-for-device在您的 android-sdk 平台工具中的终端中运行
  • 连接设备
  • 打开设备

Every time one of my devices doesn't read, this seems to fix the problem.
An alternative is to repeat all those above steps, but don't disconnect the device (i.e. turn it off, run the command, turn it on).

每次我的一台设备无法读取时,这似乎都可以解决问题。
另一种方法是重复上述所有步骤,但不要断开设备的连接(即关闭它,运行命令,打开它)。

If that doesn't work, another thing that I found that works for the older devices I use (2.1 update 1 and 2.3) is to unplug the usb, turn off usb debugging, turn back on usb debugging, and reconnect.

如果这不起作用,我发现适用于我使用的旧设备(2.1 更新 1 和 2.3)的另一件事是拔掉 USB,关闭 USB 调试,重新打开 USB 调试,然后重新连接。

回答by daveywc

I was trying to get this to work for an Acer A500 with Eclipse on Windows 8 Pro. I eventually found the solution via this link. I also had to follow the instructions at this linkin order to allow installation of an unsigned driver in Windows 8.

我试图让它在 Windows 8 Pro 上使用 Eclipse 为 Acer A500 工作。我最终通过此链接找到了解决方案。我还必须按照此链接中的说明操作,以便允许在 Windows 8 中安装未签名的驱动程序。

回答by noillusion

Assuming the correct driver has been installed successfully (No exclamation mark on the driver icon in device manager), check if the device vendor ID is listed in User\.android\adb_usb.ini.

假设已成功安装正确的驱动程序(设备管理器中的驱动程序图标上没有感叹号),请检查设备供应商 ID 是否列在 User\.android\adb_usb.ini 中。

You device vendor ID can be found at http://developer.android.com/tools/device.html

您可以在http://developer.android.com/tools/device.html上找到您的设备供应商 ID

After adding the new vendor ID, reconnect the device and restart adb

添加新的供应商ID后,重新连接设备并重启adb

For more details see this thread adb not finding my device / phone (MacOS X)

有关更多详细信息,请参阅此线程adb 未找到我的设备/手机 (MacOS X)

回答by mtmurdock

I am using an HTC, so it may be different, but for me i have to sync the device with the pc before it will recognize the phone. When its ready, a notification pops saying that the device is attached for debugging.

我使用的是 HTC,所以它可能会有所不同,但对我来说,我必须先将设备与电脑同步,然后才能识别手机。当它准备好时,会弹出一个通知,说设备已连接以进行调试。

Also, you need to mark your app as debuggable if you haven't already done that as explained here

此外,如果您尚未按照此处的说明进行操作,则需要将您的应用标记为可调试

回答by JRL

Have you tried killing the adb process and starting it back up again? That's worked for me before.

您是否尝试过杀死 adb 进程并重新启动它?这以前对我有用。

回答by Scott Biggs

I just purchased a new android phone (LG) and was also having some difficulty. It seems that my phone would disable debugging on its own whenever I would plug it in to the USB port.

我刚刚购买了一部新的 android 手机 (LG),也遇到了一些困难。似乎每当我将手机插入 USB 端口时,我的手机都会自行禁用调试。

My solution is to plug the phone in, and THEN enable debugging.

我的解决方案是插入手机,然后启用调试。

回答by Jorgesys

Kal I had the same situation some months ago, my device was recognized for my computer but adb doesn't recognize my device is connected, I had to update from the device manager.... hope it helps you!

Kal 几个月前我遇到了同样的情况,我的设备被我的计算机识别,但 adb 无法识别我的设备已连接,我不得不从设备管理器更新......希望它对你有所帮助!

adb driver isntalling error

adb 驱动程序安装错误

回答by CommonsWare

Make sure you have Motorola's USB driver, as is described on this thread.

确保您拥有摩托罗拉的 USB 驱动程序,如本主题所述