adb 无法识别 Android 设备

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

Android Device not recognized by adb

androidadbnexus-4

提问by user3135185

My Android device isn't recognized by eclipse nor adb anymore. My OS is Windows 7 64-bit, and I'm using a Nexus 4 with Stock Android 4.4.2.

我的 Android 设备不再被 eclipse 或 adb 识别。我的操作系统是 Windows 7 64 位,我使用的是带有 Stock Android 4.4.2 的 Nexus 4。

Here are some details on the problem:

以下是有关该问题的一些详细信息:

  1. Yesterday I could run Android Projects from eclipse on my device with no problems. The only thing that I did on eclipse, which could have caused this problem, was installing the v7 appcompat support library from a resource to eclipse using this guide on developers.android (https://developer.android.com/tools/support-library/setup.html).
  2. The device is still recognized as a normal multimedia drive in Windows when it's not in debug mode.
  3. The device is in Developers mode and in Debug mode when I try to run an Android Project in eclipse or try to see if it's recognized by adb using adb devicesin the console.
  4. The Google USB drivers have been installed through the ADK Manager
  5. The USB OEM drivers for Windows have already been installed according to the tutorial on the android-developers site (see: https://developer.android.com/tools/extras/oem-usb.html)
  6. I tried to restart adb by using the commands adb kill-serverand adb start-server, and again checked if the devices was recognized by using adb devices. The device was still not listed on the console.
  7. Restarting windows & eclipse did not fix this problem.
  1. 昨天我可以在我的设备上从 eclipse 运行 Android 项目,没有任何问题。我在 eclipse 上做的唯一一件事可能会导致这个问题,就是使用 developer.android ( https://developer.android.com/tools/support-库/setup.html)。
  2. 当设备不在调试模式下时,它仍然被识别为 Windows 中的普通多媒体驱动器。
  3. 当我尝试在 eclipse 中运行 Android 项目或尝试查看它是否被adb devices控制台中的adb 识别时,设备处于开发人员模式和调试模式。
  4. Google USB 驱动程序已通过 ADK 管理器安装
  5. 已经根据 android-developers 站点上的教程安装了适用于 Windows 的 USB OEM 驱动程序(请参阅:https: //developer.android.com/tools/extras/oem-usb.html
  6. 我尝试使用命令adb kill-server和重新启动 adb adb start-server,并再次检查是否使用adb devices. 该设备仍未在控制台上列出。
  7. 重新启动 windows 和 eclipse 没有解决这个问题。

Does anyone know a solution for this problem? Thanks in advance!

有谁知道这个问题的解决方案?提前致谢!

UPDATE:Thanks for the repies, the problem is solved (for now). I tried the following suggestions in this order:

更新:感谢您的回复,问题已解决(暂时)。我按此顺序尝试了以下建议:

  1. I restarted my device - this did not fix the problem
  2. I set my device to PTP mode - this fixed the problem.
  1. 我重新启动了我的设备 - 这并没有解决问题
  2. 我将设备设置为 PTP 模式 -这解决了问题。

So I reset my device to MTP mode & debug mode again to check if it still would be recognised by adb for some reason. It definitly doesn't get recognised by adb when it's in MTP-mode. I don't know how it got recognised some days ago, because I never setmy device to PTP-mode. Anyway, the solution to my problem is that my Nexus 4 must be in PTP-Mode and of course in debug-mode to get recognised by adb.

所以我再次将我的设备重置为 MTP 模式和调试模式,以检查它是否仍会因某种原因被 adb 识别。当它处于 MTP 模式时,它肯定不会被 adb 识别。我不知道几天前它是如何被识别的,因为我从未将我的设备设置为 PTP 模式。无论如何,我的问题的解决方案是我的 Nexus 4 必须处于 PTP 模式,当然也必须处于调试模式才能被 adb 识别。

I didn't try any other suggestions since my problem got solved with my current drivers.

我没有尝试任何其他建议,因为我的问题用我当前的驱动程序解决了。

回答by ajacian81

Generally, I think your USB connection should be set to use MTP (Media Transfer), however, I couldn't get my computer to recognize my device (Nexus 4). Oddly, setting the USB connection to Camera got it working for me.

通常,我认为您的 USB 连接应该设置为使用 MTP(媒体传输),但是,我无法让我的计算机识别我的设备(Nexus 4)。奇怪的是,将 USB 连接设置为相机让它对我有用。

回答by Aritra Roy

I also faced the same problem and tried almost everything possible from manually installing drivers to editing the winusb.inf file. But nothing worked for me.

我也遇到了同样的问题,尝试了几乎所有可能的方法,从手动安装驱动程序到编辑 winusb.inf 文件。但没有什么对我有用。

Actually, the solution is quite simple. Its always there but we tend to miss it.

其实,解决办法很简单。它总是在那里,但我们往往会错过它。

Prerequisites

先决条件

Download the latest Android SDK and the latest drivers from here. Enable USB debugging and open Device Manager and keep it opened.

这里下载最新的 Android SDK 和最新的驱动程序。启用USB调试并打开设备管理器并保持打开状态。

Steps

脚步

1) Connect your device and see if it is detected under "Android Devices" section. If it does, then its OK, otherwise, check the "Other devices" section and install the driver manually.

1) 连接您的设备并查看是否在“Android 设备”部分下检测到它。如果是,则可以,否则,请检查“其他设备”部分并手动安装驱动程序。

2) Be sure to check "Android Composite ADB Interface". This is the interface Android needs for ADB to work.

2) 一定要勾选“Android Composite ADB Interface”。这是 Android 需要 ADB 工作的接口。

3) Go to "[SDK]/platform-tools", Shift-click there and open Command Prompt and type "adb devices" and see if your device is listed there with an unique ID.

3) 转到“[SDK]/platform-tools”,按住 Shift 键并单击那里并打开命令提示符并键入“adb devices”,然后查看您的设备是否以唯一 ID 列出。

4) If yes, then ADB have been successfully detected at this point. Next, write "adb reboot bootloader" to open the bootloader. At this point check Device Manager under "Android Devices", you will find "Android Bootlaoder Interface". Its not much important to us actually.

4) 如果是,则此时已成功检测到ADB。接下来,编写“adb reboot bootloader”以打开引导加载程序。此时查看“Android 设备”下的“设备管理器”,会发现“Android Bootlaoder 界面”。它实际上对我们来说并不重要。

5) Next, using the volume down keys, move to "Recovery Mode".

5)接下来,使用降低音量键,移至“恢复模式”。

6) THIS IS IMPORTANT - At this point, check the Device Manger under "Android Devices". If you do not see anything under this section or this section at all, then we need to manually install it.

6) 这很重要 - 此时,检查“Android 设备”下的设备管理器。如果您在本节或本节下根本没有看到任何内容,那么我们需要手动安装它。

7) Check the "Other devices" section and find your device listed there. Right click -> Update drivers -"Browse my computer..." -> "Let me pick from a list..." and select "ADB Composite Interface".

7) 检查“其他设备”部分并在那里找到您的设备。右键单击-> 更新驱动程序-“浏览我的计算机...”->“让我从列表中选择...”并选择“ADB 复合接口”。

8) Now you can see your device listed under "Android Devices" even inside the Recovery.

8) 现在,即使在恢复中,您也可以看到您的设备列在“Android 设备”下。

9) Write "adb devices" at this point and you will see your device listed with the same ID.

9) 此时输入“adb devices”,您将看到列出的设备具有相同的 ID。

10) Now, just write "adb sideload [update].zip" and your are done.

10) 现在,只需编写“adb sideload [update].zip”即可完成。

Hope this helps.

希望这可以帮助。

回答by Dragan Ostoji?

Fundamentally, the issue has to do with not being able to get MTP+ADB working while for example PTP+ADB may work. In my case when I plugged Nexus 5, windows 7 will install only MTP driver completely ignoring ADB. I couldn't find a good solution for this problem anywhere else so here I provide steps (some of the steps I copied from other sources):

从根本上说,这个问题与无法让 MTP+ADB 工作有关,而例如 PTP+ADB 可能工作。就我而言,当我插入 Nexus 5 时,Windows 7 将仅安装 MTP 驱动程序,完全忽略 ADB。我在其他任何地方都找不到解决这个问题的好方法,所以在这里我提供了一些步骤(我从其他来源复制的一些步骤):

0) Unplug Nexus 5. Make sure you selected MTP and ADB.

0) 拔下 Nexus 5。确保您选择了 MTP 和 ADB。

1) Make sure that sdk\extras\google\usb_driverandroid_winusb.inf in Google SDK had the following lines (in two places in that file):

1) 确保 Google SDK 中的 sdk\extras\google\usb_driverandroid_winusb.inf 有以下几行(在该文件的两个地方):

;Google Nexus (generic)

;Google Nexus(通用)

%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE2&MI_01

%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE2&MI_01

NOTE: VID_18D1 is Google VID, PID_4EE2 is PID for MTP+ADB, MI_01 means that ADB is on interface 1 (MTP is on interface 0).

注意:VID_18D1 是 Google VID,PID_4EE2 是 MTP+ADB 的 PID,MI_01 表示 ADB 在接口 1(MTP 在接口 0)。

You can check what is on what interface by plugging Nexus 5 into a Linux system and typing lsusb.

您可以通过将 Nexus 5 插入 Linux 系统并键入 lsusb 来检查哪个界面上有什么。

2) first delete all installed Google USB drivers. One good tool is called USBDeview and can be find at the following location: http://www.nirsoft.net/utils/usb_devices_view.htmlDownload the tool and run it (there is no need to install it). Take a look at the colored status indicator on the far-left of the USBDeview window. Green indicates the the device functions properly. Pink means the device can unplug and works properly (although it may not actually work properly). Red indicates a disabled USB device. Gray (circled, below) means the device is installed, but not connected. Second, remove all gray items with the words “Google”, “Linux”, “ADB”, or “Android” in the title.

2)首先删除所有安装的谷歌USB驱动程序。一个很好的工具叫做 USBDeview,可以在以下位置找到: http://www.nirsoft.net/utils/usb_devices_view.html下载该工具并运行它(不需要安装它)。查看 USBDeview 窗口最左侧的彩色状态指示器。绿色表示设备功能正常。粉红色表示设备可以拔掉电源并正常工作(尽管它实际上可能无法正常工作)。红色表示已禁用的 USB 设备。灰色(下图圈出)表示设备已安装,但未连接。其次,删除标题中带有“Google”、“Linux”、“ADB”或“Android”字样的所有灰色项目。

3) Now delete old cached Google *.inf files. Open a Windows Explorer and navigate to the C:\Windows\INF directory. Somewhere in there there is an "oemN.inf" file (where N is a number that will vary on your system) that is a copy of the android_usb.inf -- the thing to do is to find which file and remove it. Windows keeps a cache of the INF files here and what we found is that sometimes an older cached copy is used instead of a newer version.

3) 现在删除旧的缓存 Google *.inf 文件。打开 Windows 资源管理器并导航到 C:\Windows\INF 目录。在那里的某个地方有一个“oemN.inf”文件(其中 N 是一个会因您的系统而异的数字),它是 android_usb.inf 的副本——要做的是找到哪个文件并将其删除。Windows 在此处保留 INF 文件的缓存,我们发现有时会使用较旧的缓存副本而不是较新的版本。

One simple way to find which one using the Windows Explorer: - In the explorer's Search box, enter "androidwinusb86.cat" without the quotes. - Typically the search will be empty because no filename has this pattern. - Go to Tools/Folder Options, click Search Tab and click Always search file name and contents. Click Apply - Search again. This time it should list a few files such as "oem90.inf" (you'll have one or more, with different numbers).

使用 Windows 资源管理器查找哪一个的一种简单方法: - 在资源管理器的搜索框中,输入不带引号的“androidwinusb86.cat”。- 通常搜索将为空,因为没有文件名具有此模式。- 转到工具/文件夹选项,单击搜索选项卡,然后单击始终搜索文件名和内容。单击应用 - 再次搜索。这次它应该列出一些文件,例如“oem90.inf”(您将拥有一个或多个,具有不同的编号)。

Now use the Windows Explorer and delete the "oemNN.*" files that matched above (only those with androidwinusb in them.).

现在使用 Windows 资源管理器并删除上面匹配的“oemNN.*”文件(仅那些包含 androidwinusb 的文件。)。

4) We now want to disable installation of MTP by windows before windows discovers ADB. Now search for wpdmtp.* files in the same directory. Presence of these files will force install MTP disregarding ADB class in the same (composite) device. Move these files out of \inf folder

4) 我们现在想在 windows 发现 ADB 之前禁用 windows 安装 MTP。现在在同一目录中搜索 wpdmtp.* 文件。这些文件的存在将强制安装 MTP,而忽略同一(复合)设备中的 ADB 类。将这些文件移出 \inf 文件夹

5) plug in the device again. This time, both MTP and Android ADB driver installation will fail.

5) 再次插入设备。这一次,MTP和Android ADB驱动安装都会失败。

6) Find Other devices in the Device Manager and when expanded it should show Nexus 5 and MTP. Right click and update Nexus 5 by navigating to the sdk\extras\google\usb_driver\android_winusb.inf.

6) 在设备管理器中查找其他设备,展开后应显示 Nexus 5 和 MTP。右键单击并通过导航到 sdk\extras\google\usb_driver\android_winusb.inf 来更新 Nexus 5。

Move wpdmtp.* files back to \inf folder. Right click MTP device and update.

将 wpdmtp.* 文件移回 \inf 文件夹。右键单击 MTP 设备并更新。

7) If necessary, confirm on your Nexus 5 that this PC has access to the phone.

7) 如有必要,请在您的 Nexus 5 上确认此 PC 可以访问手机。

8) If everything went as expected you should see in Device Manager the following:

8) 如果一切按预期进行,您应该在设备管理器中看到以下内容:

  • Expand Android Device. Right click Android Composite ADB Interface, select Properties, choose tab Details, under Property select Hardware Ids. You should see USB\VID_18D1&PID_4EE2&MI_01

  • Expand Portable devices. Right click Nexus 5, select Properties, choose tab Details, under Property select Hardware Ids. You should see USB\VID_18D1&PID_4EE2&MI_00

  • 展开 Android 设备。右键单击Android Composite ADB Interface,选择Properties,选择选项卡Details,在Property 下选择Hardware Ids。你应该看到 USB\VID_18D1&PID_4EE2&MI_01

  • 展开便携式设备。右键单击 Nexus 5,选择属性,选择选项卡详细信息,在属性下选择硬件 ID。你应该看到 USB\VID_18D1&PID_4EE2&MI_00

回答by Nativ

Try use PdaNet. you can download it from here

尝试使用 PdaNet。你可以从这里下载

It installs missing drivers when you plugin your device.

当您插入设备时,它会安装缺少的驱动程序。

Obviously make sure you "debug usb" option in "developers options" is on.

显然,请确保“开发人员选项”中的“调试 USB”选项已打开。

Another thing, it's important to uninstall any device's installed driver before using it.

另一件事,重要的是在使用任何设备之前卸载它已安装的驱动程序。

回答by Hesam

I recently had this issue (but before that debug over wifi was working fine) and since none of above answers helped me let me share what I did.

我最近遇到了这个问题(但在 wifi 上的调试工作正常之前)并且由于上述答案都没有帮助我让我分享我所做的。

  1. Go to developer options
  2. Find Select USB configurations and click it
  3. Choose MTP (Media Transfer Protocol)
  1. 进入开发者选项
  2. 找到选择 USB 配置并单击它
  3. 选择 MTP(媒体传输协议)

Note: If it's set to this option chose another option such as PTP first then set it to MTP again.

注意:如果设置为该选项,请先选择另一个选项,例如 PTP,然后再次将其设置为 MTP。

回答by FlorianB

It may sound silly but in my case the USB cable was too long (even if good quality). It worked with my tablet but not with the phone. To check this, if you run on Linux run lsusb to make sure that your device is at least officially connect to the usb port.

这听起来可能很傻,但就我而言,USB 电缆太长(即使质量很好)。它适用于我的平板电脑,但不适用于手机。要检查这一点,如果您在 Linux 上运行,请运行 lsusb 以确保您的设备至少正式连接到 USB 端口。

回答by Rafael Delbel

With USB connected, on android device Settings > Developer options > Revoke USB debug authorizations USB Debug. Remove the USB and connect again, then "Allow USB debugging".

连接 USB 后,在 android 设备设置 > 开发人员选项 > 撤销 USB 调试授权 USB 调试。拔下 USB 并重新连接,然后“允许 USB 调试”。

回答by alansiqueira27

Go to prompt command and type "adb devices". If it is empty, then make sure you allowed for "MTP Transfer" or similar and you enabled debugging on your phone.

转到提示命令并键入“adb devices”。如果它是空的,那么请确保您允许“MTP 传输”或类似功能,并且您在手机上启用了调试。

To enable debugging, follow this tutorial: https://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android.htm

要启用调试,请按照本教程进行操作:https: //www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android.htm

Then type "adb devices" again. If a device is listed in there, then it should work now.

然后再次输入“adb devices”。如果其中列出了一个设备,那么它现在应该可以工作了。

回答by Tom Taylor

Enabling Developer modeby tapping on Build Number 7 times worked for me.

通过点击内部版本号 7 次来启用开发人员模式对我有用。

回答by Jeremy Quick

Make sure you are connecting with a USB and not a lightning cable. I had this problem trying to connect using a cord with lightning cables on both ends and it would not list the device. But switching to a USB to lightning cable worked.

确保您使用的是 USB 而不是闪电电缆。我在尝试使用两端都带有避雷线的电线进行连接时遇到了这个问题,但它不会列出设备。但是切换到 USB 转闪电电缆有效。