Flutter-intellij: ADB fails only for Flutter but not for Android in Android Studio...

Created on 11 Mar 2019  路  12Comments  路  Source: flutter/flutter-intellij

It is very strange, but in Android Studio on my Mate Ubuntu 18.04 or just Ubuntu 18.04, AMD Ryzen processor when I create 'Android Project' ADB works well. But once I am creating 'Flutter' one, i have error Error initializing ADB: Android Debug Bridge not found. I tried start it on Android Studio 3.2, 3.2.1... I tried recipes from here - no way. I tried to downgrade ADB to 23.0.1 too as mentioned here.

adb in console (via Alt-F12) works well. But Device File Explorer shows Error initializing blah-blah and i can not debug and see files in emulators and device...

Here is log:

ADB not found
java.lang.Throwable: ADB not found
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:126)
    at com.android.tools.idea.explorer.adbimpl.AdbDeviceFileSystemService.start(AdbDeviceFileSystemService.java:107)
    at com.android.tools.idea.explorer.DeviceExplorerController.setup(DeviceExplorerController.java:139)
    at com.android.tools.idea.explorer.DeviceExplorerToolWindowFactory.createToolWindowContent(DeviceExplorerToolWindowFactory.java:51)
    at com.intellij.openapi.wm.impl.ToolWindowImpl.ensureContentInitialized(ToolWindowImpl.java:571)
    at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.lambda$initToolWindow$10(ToolWindowManagerImpl.java:510)
    at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.initToolWindow(ToolWindowManagerImpl.java:513)
    at com.intellij.facet.impl.ui.FacetDependentToolWindowManager.ensureToolWindowExists(FacetDependentToolWindowManager.java:93)
    at com.intellij.facet.impl.ui.FacetDependentToolWindowManager.projectOpened(FacetDependentToolWindowManager.java:81)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.fireProjectOpened(ProjectManagerImpl.java:775)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.lambda$null$6(ProjectManagerImpl.java:391)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransactionAndWait$2(TransactionGuardImpl.java:165)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
    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:822)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
    at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:905)
    at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:215)
    at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:201)
    at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:579)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:109)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runSynchronously(CoreProgressManager.java:318)
    at com.intellij.openapi.progress.impl.CoreProgressManager.run(CoreProgressManager.java:303)
    at com.intellij.openapi.progress.ProgressManager.run(ProgressManager.java:192)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:483)
    at com.intellij.ide.impl.ProjectUtil.openProject(ProjectUtil.java:191)
    at com.intellij.ide.RecentProjectsManagerImpl.doOpenProject(RecentProjectsManagerImpl.java:63)
    at com.intellij.ide.RecentProjectsManagerBase.doReopenLastProject(RecentProjectsManagerBase.java:677)
    at com.intellij.ide.RecentProjectsManagerBase$MyAppLifecycleListener.appStarting(RecentProjectsManagerBase.java:719)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
    at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:426)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:387)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:376)
    at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:357)
    at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:43)
    at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:208)
    at com.sun.proxy.$Proxy79.appStarting(Unknown Source)
    at com.intellij.idea.IdeaApplication$IdeStarter.lambda$main$1(IdeaApplication.java:379)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
    at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
    at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
    at com.intellij.idea.IdeaApplication$IdeStarter.main(IdeaApplication.java:377)
    at com.intellij.idea.IdeaApplication.lambda$run$0(IdeaApplication.java:208)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:208)
    at com.intellij.idea.MainImpl$1.lambda$null$0(MainImpl.java:49)
    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.dispatchEvent(IdeEventQueue.java:380)
    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)

flutter - doctor

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[鉁揮 Flutter (Channel stable, v1.2.1, on Linux, locale en_US.UTF-8)
[鉁揮 Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[鉁揮 Android Studio (version 3.3)
[!] Connected device
    ! No devices available

Most helpful comment

Same problem for me. (If this really is a 'ghost fault' then this ghost is going round. ;-)
...
Has anyone a solution to this? Thank you in advance!
Take a glance here

Thank you so much ValeriusGC! You put me on the right track. :-)

4 all others - check:
-> File -> Project Structure:
-> Project (if it has a valid Project SDK) and under
-> Modules -> Dependencies (a valid Module SDK)

All 12 comments

Keep in mind that almost the same configuration works well at work in my office but on Intel Core I7.

Screenshot for Flutter project:
image

Screenshot for Android one:
image

Valery,

Looks like your on AS 3.3, Flutter 1.2 and I presume Dart 2.2. Have you tried a cold start of the emulator and/or deleting the emulator and re-installing the emulator for SDK 28?

How are you starting Android Studio? If from a UI task launcher, it often doesn't get the normal environment variables, including the PATH, and it can then be hard to find common cli tools

I would try setting the path to Android Studio explicitly via 'fluter config' (flutter config --android-studio-dir path/to/android/studio), and see if that helps. You'd need to restart android studio for that to take effect.

It's look like 'ghost fault'. I just added Android NDK and now all is OK.
I tried to start AS both from UI and from terminal and it had no effect.
If somethig will go wrong in the future, i will try your advice with flutter config --android-studio-dir path/to/android/studio, thanks.

I'm having the same problem, tried all the solutions presented and none worked. I reinstalled all my SDK tools and also unsuccessfully.

Flutter Version: 1.2.1
Dart Version: 2.1.2
Android Studio Version: 3.4.2 for Windows 64-bit

Same problem for me. (If this really is a 'ghost fault' then this ghost is going round. ;-)

I tried all recommendations above (flutter config ...). Nothing helps. ADB is working on my console (env vars set ...) and 'flutter doctor' shows no errors:
[鈭歖 Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17763.592], locale de-DE)
[鈭歖 Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[鈭歖 Android Studio (version 3.4)
[鈭歖 VS Code (version 1.36.1)
[鈭歖 Connected device (1 available)

Has anyone a solution to this? Thank you in advance!

Same problem for me. (If this really is a 'ghost fault' then this ghost is going round. ;-)
...
Has anyone a solution to this? Thank you in advance!
Take a glance here

Same problem for me. (If this really is a 'ghost fault' then this ghost is going round. ;-)
...
Has anyone a solution to this? Thank you in advance!
Take a glance here

Thank you so much ValeriusGC! You put me on the right track. :-)

4 all others - check:
-> File -> Project Structure:
-> Project (if it has a valid Project SDK) and under
-> Modules -> Dependencies (a valid Module SDK)

Same problem for me. (If this really is a 'ghost fault' then this ghost is going round. ;-)
...
Has anyone a solution to this? Thank you in advance!
Take a glance here

Thank you so much ValeriusGC! You put me on the right track. :-)

4 all others - check:
-> File -> Project Structure:
-> Project (if it has a valid Project SDK) and under
-> Modules -> Dependencies (a valid Module SDK)

Thanks guys, finally got it working!

Ensure valid SDKs at both points, as walberla says.

To anyone who ended up here but can't find File -> ProjectStructure, this is probably because you didn't initially create the project with Android Studio.
I used vscode for example.

I created a new flutter project with android studio and compared the files in the .idea folder. I noticed my original project didn't have a misc.xml file. Adding this and restarting, created the ProjectStructure entry in File menu. You can then check the options described above.

For me @publicJorn's solution didn't work and after doing all types of unnecessary configuration and things like that I finally made it work...

You have to close the project in android studio (File -> close project)
Press the X next to the project name in the project viewer to remove it
Delete all files/folders in the project folder which are connected to android studio (I only had .idea, but you may have .gradle and things like that.)
Reimport the project folder into android studio
Now while importing it will ask for SDK version and selecting the appropriate version will make adb work.

I hope this helps somebody

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matejthetree picture matejthetree  路  4Comments

SAGARSURI picture SAGARSURI  路  3Comments

devoncarew picture devoncarew  路  3Comments

moodi1999 picture moodi1999  路  4Comments

brianegan picture brianegan  路  3Comments