1

关于错误信息:Unable to locate adb.

我遵循了人们在其他线程上所说的内容,但没有一个有效。所以我在 SDK 管理器中卸载了 Android SDK 平台工具。Android Studio 不喜欢我这样做,所以 30 分钟后我取消了卸载。现在它一直在执行“Stopping -Installing Android SDK”并显示我的这条消息:"Cannot run program "C:\Users\admin\AppData\Local\Android\Sdk\platform-tools\adb.exe": CreateProcess error=2, The system cannot find the file specified"

我不知道该怎么做。我将把错误信息放在下面。非常感谢您的回复。

java.lang.IllegalArgumentException: Unable to locate adb
    at com.android.tools.idea.run.editor.DeployTargetPickerDialog.<init>(DeployTargetPickerDialog.java:137)
    at com.android.tools.idea.run.editor.ShowChooserTargetProvider.showPrompt(ShowChooserTargetProvider.java:97)
    at com.android.tools.idea.run.AndroidRunConfigurationBase.getDeployTarget(AndroidRunConfigurationBase.java:486)
    at com.android.tools.idea.run.AndroidRunConfigurationBase.getState(AndroidRunConfigurationBase.java:300)
    at com.intellij.execution.runners.ExecutionEnvironment.getState(ExecutionEnvironment.java:158)
    at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:55)
    at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:50)
    at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:118)
    at com.intellij.execution.impl.ExecutionManagerImpl.start(ExecutionManagerImpl.java:122)
    at com.intellij.execution.impl.ExecutionManagerImpl.access$300(ExecutionManagerImpl.java:69)
    at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:539)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:223)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:418)
    at com.intellij.util.Alarm$Request.access$700(Alarm.java:343)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:385)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:303)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:410)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:827)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:655)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
4

3 回答 3

3

当我将我的 Android Studio 从 2.3.2 升级到 3.0.1 时,我也遇到了这个错误。发生这种情况是因为 adb-path 中没有名为 adb.exe 的文件。但现在已经解决了。希望我的回答能帮到你。

首先,我在以下位置下载了最新版本的 SDK Tools:https://developer.android.com/studio/releases/platform-tools.html

其次,我将文件解压缩到 Android Studio SDK 的目录中(在我的例子中是“E:/SDK/”)。但它会用新文件重写旧文件。

三、在Android Studio中打开终端。运行这个:

  • cd "adb-path" (例如:cd "E:/SDK/platform-tools")
  • 亚行设备

完毕 :)

于 2018-01-26T11:33:05.037 回答
0

以管理员身份打开 CMD 并简单地运行下面给出的命令:

cd <adb-path> cd c:\Users\Pilot\AppData\Local\Android\sdk\platform-tools\

然后运行

adb devices
于 2017-12-23T16:44:54.083 回答
0

我有一个类似的问题。显然,我的防病毒软件(在我的情况下为 AVG)阻止了 ADB。要解决它,只需忽略上面的错误消息。去你的杀毒软件,确保 adb 没有被阻止。重启你的安卓工作室。

于 2017-12-25T10:26:53.207 回答