简体   繁体   中英

Unable to locate adb for Android Studio 3.0.1

Regarding error message: Unable to locate adb .

I followed what people said on other threads but none of them worked. So I uninstalled Android SDK platform-tools in SDK manager. Android studio didn't like me doing that so after 30 minutes I canceled the uninstalling. Now it has been doing "Stopping -Installing Android SDK" and shows my this message: "Cannot run program "C:\\Users\\admin\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe": CreateProcess error=2, The system cannot find the file specified"

I have no idea what to do. I'll put the error message below. Many thanks for any reply.

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)

I got this error when I upgraded my Android Studio from 2.3.2 to 3.0.1, too. It happened because there's no file named adb.exe in adb-path. But now it's solved. I hope my answer could help you.

First, I downloaded the latest version of SDK Tools in: https://developer.android.com/studio/releases/platform-tools.html

Second, I extracted the file into Android Studio SDK's directory (in my case is "E:/SDK/"). But it will rewrite the old files with the new one.

Third, open terminal in Android Studio. run this :

  • cd "adb-path" (eg : cd "E:/SDK/platform-tools")
  • adb devices

Done :)

Open CMD as Administrator and simply run the command given below:

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

Then run

adb devices

I had a similar issue. Apparently, My Anti-virus, in my case AVG, blocks the ADB. To solve it, just ignore the error message above. go to your anti-virus make sure adb isn't blocked. restart your android studio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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