简体   繁体   English

android studio更新后,ADB无法正常工作

[英]ADB is not working after android studio update

I have updated android studio to Android Studio v2.3.3 (June 2017) and adb stopped showing logs when I launch app on android studio emulator 我已将android studio更新为android Studio v2.3.3(2017年6月),并且在android studio模拟器上启动应用程序时adb停止显示日志

The log shows: 日志显示:

07/11 13:08:17: Launching app

$ adb push C:\\Users\\1\\AndroidStudioProjects\\Don'tWakeMeApp4\\app\\build\\outputs\\apk\\app-debug.apk /data/local/tmp/oleksandr.ivanets.dontwakemeapp $ adb shell pm install -r "/data/local/tmp/oleksandr.ivanets.dontwakemeapp" Success $ adb push C:\\ Users \\ 1 \\ AndroidStudioProjects \\ Don'tWakeMeApp4 \\ app \\ build \\ outputs \\ apk \\ app-debug.apk /data/local/tmp/oleksandr.ivanets.dontwakemeapp $ adb shell pm install -r“ /数据/本地/tmp/oleksandr.ivanets.dontwakemeapp“成功

$ adb shell am start -n "oleksandr.ivanets.dontwakemeapp/oleksandr.ivanets.dontwakemeapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Client not ready yet..Waiting for process to come online Connected to process 4429 on device Nexus_5X_API_26 [emulator-5554] $ adb shell开始-n“ oleksandr.ivanets.dontwakemeapp / oleksandr.ivanets.dontwakemeapp.MainActivity” -a android.intent.action.MAIN -c android.intent.category.LAUNCHER客户端尚未准备好。等待进程联机连接到设备Nexus_5X_API_26上的进程4429 [emulator-5554]

Click on below link 点击下面的链接

http://adbshell.com/downloads http://adbshel​​l.com/downloads

and download the first link with name ADB Kits ( contains adb.exe and necessary .dll files). 并下载名称为ADB Kits的第一个链接(包含adb.exe和必要的.dll文件)。

After downloading replace these files with the ones in the path 下载后,将这些文件替换为路径中的文件

Android/Sdk/platform-tools/ Android / SDK / platform-tools /

Now click on adb.exe and it will open cmd and will start the adb server. 现在单击adb.exe,它将打开cmd并启动adb服务器。

Now it will detect the device and no problem. 现在它将检测到设备,没有问题。 OOOOOllllaaaaa..... OOOOOllllaaaaa .....

If the Problem persists again then do the same... save the folder somewhere.... just replace files... it will detect the device automatically then 如果问题仍然存在,请执行相同的操作...将文件夹保存在某处...。只需替换文件...它将自动检测设备,然后

Preface: Although my answer focuses on Android Studio's perspective of ADB errors, I'm sure it is helpful for Windows ADB debugging in general! 前言:尽管我的回答集中在Android Studio对ADB错误的看法上,但我相信它通常对Windows ADB调试很有帮助!

@sHaRkBoY 's answer helped me look in the right direction. @sHaRkBoY的回答帮助我朝正确的方向看。 I used to get "Unable to detect adb version, adb output:" on Android Studio while trying to "run" the app onto the phone... and no devices showed up when phone was connected to PC. 我曾试图在手机上“运行”该应用程序时在Android Studio上收到“无法检测adb版本,adb输出:”的信息 ,并且当手机连接到PC时没有设备出现。

I had tried all these (from different SO answers) but none of them worked!!! 我已经尝试了所有这些方法(从不同的SO答案中选择), 但是它们都不起作用! :

  • "Invalidate cache and restart" from File toolbar. 从“ File工具栏“使缓存无效并重新启动”。
  • Turn off and turn on USB debugging on phone multiple times 多次关闭并打开手机上的USB调试
  • Experimented with "MTP", "PTP", "Midi" and "Charging" modes to see if ADB detects something... 在“ MTP”,“ PTP”,“ Midi”和“ Charging”模式下进行了实验,以查看ADB是否检测到某些东西...
  • Checked my anti-virus software to see if adding exceptions to the adb directory works... 检查了我的防病毒软件,看看是否可以向adb目录添加例外...
  • Installed various unnecessary C++ re-distributables 安装了各种不必要的C ++可再分发文件
  • Tried a different USB cable (and USB port) 尝试使用其他USB电缆(和USB端口)
  • Restarted Android Studio and PC 重新启动Android Studio和PC
  • and even uninstalled and re-installed Android studio! 甚至卸载并重新安装了Android Studio!

The problem finally was that the platform_tools\\adb.exe file downloaded by the official SDK tool manager was corrupted! 最后的问题是,官方SDK工具管理器下载的platform_tools\\adb.exe文件已损坏! So I used to get windows error code 0xc0000142 on launching adb.exe from command prompt! 因此,我通常从命令提示符启动adb.exe时得到Windows错误代码0xc0000142! :( :(

SOLUTION: 解:

For future readers (and victims xD) of the above ADB problem, please do the following: 对于上述亚行问题的未来读者(以及受害者xD),请执行以下操作:

  1. Firstly, add the platform_tools\\ directory into the system path environment variable. 首先,将platform_tools\\目录添加到系统路径环境变量中。

  2. Go ahead and replace the following 3 files in your platform_tools ( C:\\Users\\{YourAccount}\\AppData\\Local\\Android\\Sdk\\platform-tools ) directory. 继续并替换您的platform_toolsC:\\Users\\{YourAccount}\\AppData\\Local\\Android\\Sdk\\platform-tools )目录中的以下3个文件。 (Please backup the same folder before, just in case.) (以防万一,请先备份相同的文件夹。)

ADB kit (internal version number: 32) ADB套件(内部版本号:32)


Note : Please prefer this ADB kit (exe and dll files), compared to @sHaRkBoY 's ADB kit (2.0.0.0), since it has an updated version of AdbWinUsbApi.dll (2.0.0.1), where a race condition issue has been fixed! 注意 :与@sHaRkBoY的ADB工具包(2.0.0.0)相比,请使用此ADB工具包(exe和dll文件),因为它具有AdbWinUsbApi.dll (2.0.0.1)的更新版本,在该版本中存在竞争条件问题已修复!

I hope my answer saves your from the traumatic experience I went through while troubleshooting magical ADB for an entire day! 希望我的回答能使您摆脱一整天对ADB进行故障排除时所经历的痛苦经历! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM