flutter-intellij: Unable to run a Flutter app because even Device File Explorer can detect it

Description

I plugged my device to my development laptop to run a Flutter app. My laptop is already allowed to connect to my mobile device.

However, the button Run does not allow me to deploy the app to the connected device because it thinks that there is no connected device. It is quite wrong. The tab Device File Explorer can browse files in the device already.

The flutter CLI tool can detect the connected device too

C:\Users\pcdinh>flutter upgrade
Upgrading Flutter from D:\dev\flutter...
From https://github.com/flutter/flutter
   0260642fc..1c3f6a851  master     -> origin/master
Updating 0260642fc..1c3f6a851
 2 files changed, 31 insertions(+), 1 deletion(-)

Upgrading engine...
Updating flutter tool...
Already up-to-date.

Flutter 0.2.12-pre.29 • channel master • https://github.com/flutter/flutter.git
Framework • revision 0260642fc5 (6 hours ago) • 2018-04-12 21:16:39 -0700
Engine • revision 76cb311d9c
Tools • Dart 2.0.0-dev.47.0.flutter-f76dad0adc

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v0.2.12-pre.30, on Microsoft Windows [Version 10.0.16299.309], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    X Android license status unknown.
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Community Edition (version 2017.3)
[√] VS Code, 64-bit edition (version 1.22.1)
[√] Connected devices (1 available)

! Doctor found issues in 1 category.

Steps to Reproduce

  • Launch Android Studio with the latest Flutter plugin
  • Edit code
  • Plugin the device and ensure that the device is connected.
  • Press “Run” icon. The dialog appears: “No connected devices found; please connect a device, or see flutter.io/setup for getting started instructions.”'. However, the tab Device File Explorer can see files in the device.

Screenshot: https://imgur.com/a/qEJrR

Version info

D:\dev\flutter\bin\flutter.bat --no-color doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v0.2.12-pre.30, on Microsoft Windows [Version 10.0.16299.309], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    X Android license status unknown.
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Community Edition (version 2017.3)
[√] VS Code, 64-bit edition (version 1.22.1)
[√] Connected devices (1 available)
Android Studio 3.1.1
Flutter plugin 23.2.2

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 21
  • Comments: 56 (2 by maintainers)

Most upvoted comments

Exit and start Android Studio again can solve the issue

I was able to fix this by doing the following advice found in this stackoverflow question:

https://stackoverflow.com/a/51644461/3268303

daz@iloveyou:/media/development/source/publicRepos/woo_flutter$ echo $ANDROID_HOME
/media/development/android-sdk/adt-bundle-linux-x86_64-20131030/sdk
daz@iloveyou:/media/development/source/publicRepos/woo_flutter$ flutter config --android-sdk /media/development/android-sdk/adt-bundle-linux-x86_64-20131030/sdk
Setting "android-sdk" value to "/media/development/android-sdk/adt-bundle-linux-x86_64-20131030/sdk".

set the --android-sdk in the flutter config and now I can deploy directly to android devices from Android Studio

My android project can connect my phone , but The Flutter project can’t connect my phone. show “no devices”

I have the same problem on Ubuntu

I had the same problem on Windows 10 with Android SDK installed to a ‘non-standard’ location not on C:\

Fixed by setting ANDROID_HOME environment variable to the SDK path (E:\AndroidSDK in my case)

Android Studio then found the device and launched flutter app on the device.

I’m guessing the flutter plugin doesn’t query AndroidStudio for the SDK location?

Flutter doctor says

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    X Android license status unknown.

Fix that by doing this

flutter doctor --android-licenses

Experiencing this on Ubuntu

My android project can connect my phone , but The Flutter project can’t connect my phone. show “no devices”

I also have this problem on Mac, with such configuration: Android Studio 3.0.1 Build #AI-171.4443003, built on November 9, 2017 JRE: 1.8.0_152-release-915-b08 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.6

flutter divices gives following answer: 2 connected devices: SM G930F • ad081603... • android-arm64 • Android 8.0.0 (API 26) iPhone • dd1e8d6912e... • ios • iOS 11.2.5

Those devices suddenly disappeared from Android Stuido, but were available before.

@EDIT: It shown up again after running: flutter run -d <deviceId>

dazza5000’s solution is successful.

It should be that the flutter plugin does not find the location of the android sdk.

We only need to tell flutter the location of android sdk explicitly:

flutter config --android-sdk [android-sdk-path]

For example, my android sdk path is ~/develop/android-sdk, this will solve the problem:

flutter config --android-sdk ~/develop/android-sdk

The following is just an extension of the knowledge.

You can see some parameters that are allowed to be configured and parameters that have already been configured by executing the flutter config -h command:

    --[no-]analytics
    --clear-ios-signing-cert
    --gradle-dir
    --android-sdk
    --android-studio-dir

For example, configure the location of the gradle:

flutter config --gradle-dir ~/develop/gradle

In my case, I correct the flutter SDK path and it works for me 😃 You can set the correct flutter SDK path from Preference> Language and framework> flutter

Similar. I usually have 2 Android Studio windows open, 1 with a flutter app, 1 with a plain Android app. The latter has no problems, the former frequently (almost always after sleep, often even just after launching AS) gives “no connected devices found”.

Sometimes Fixed by calling “flutter devices” in AS’s Terminal at the bottom.

ANDROID_HOME and ANDROID_SDK_ROOT are set correctly.

I too was seeing the <no devices> label, even though several AVDs and real devices were present.

In my case, the problem was that I had not set up the tools/ directory in my PATH environment variable:

export ANDROID_HOME=/path/to/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools       <--- I was missing this one

export PATH=$PATH:/path/to/flutter/bin

Somehow, official documentation tend to forget about the tools/ directory; only the platform-tools/ are mentioned.

Has had the same problem. <no device> was shown in Android Studio but was be able to run it in terminal using flutter run. Solved by updating SDK and Emulator to latest available versions.

@tribals Thank you, did the same. I got Android Q SDK and Image and it works !

Has had the same problem. <no device> was shown in Android Studio but was be able to run it in terminal using flutter run. Solved by updating SDK and Emulator to latest available versions.

I see this regularly.

kill -9 dart

reliably solves it for me.

It might be related to having multiple projects open at the same time but I wasn’t able to find a reliable pattern.

meet the same problem I just kill all flutter process and restart AndroidStudio I think caused by flutter cli only support one process Waiting for another flutter command to release the startup lock...