flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.95k stars 311 forks source link

Unable to run a Flutter app because <no devices> even Device File Explorer can detect it #2084

Open pcdinh opened 6 years ago

pcdinh commented 6 years ago

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

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
pcdinh commented 6 years ago

Exit and start Android Studio again can solve the issue

pq commented 6 years ago

Does this happen consistently? Does it get discovered after being unplugged and reconnected?

Thanks for the report!

stevemessick commented 6 years ago

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
edman commented 5 years ago

I have the same problem on Android Studio 3.1, and Intellij 2018.1. flutter does recognize, build and install the apk on my device, but never managed to get it working on the IDE.

This happens on my linux machine, on my mac os laptop it works as expected.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel border, v0.5.2-pre.70, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.1)
[✓] Android Studio (version 3.0)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Community Edition (version 2018.1)
[✓] Connected devices (1 available)

• No issues found!
caveligh commented 5 years ago

I had the same problem and I resolved uninstalling Android Studio (version 3.0). The two versions can not exist at the same time.

hbwangzhen commented 5 years ago

My android project can connect my phone , but The Flutter project can't connect my phone. show "no devices"

Cxuef commented 5 years ago

The same issue ! I can see my device using this command:

eirot@eirot-Precision-T1700:~/flutter_sdk_linux/flutter/bin$ ./flutter devices 1 connected device:

SUGAR S20 • 3bc622a8 • android-arm64 • Android 8.1.0 (API 27)

And can also use "flutter run" command to install flutter app successfully, but Android studio still show "".

Android studio version : Android Studio 3.1.3 Build #AI-173.4819257, built on June 5, 2018

flutter plugin version : Version: 26.0.1

flutter sdk version : flutter_linux_v0.5.6-dev.tar

ojhero commented 5 years ago

My android project can connect my phone , but The Flutter project can't connect my phone. show "no devices"

TheHasnatBD commented 5 years ago

I have the same problem on Ubuntu

dazza5000 commented 5 years ago

Experiencing this on Ubuntu

Kamil-H commented 5 years ago

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>

Deracination commented 5 years ago

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?

mamert commented 5 years ago

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.

dazza5000 commented 5 years ago

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

gliheng commented 5 years ago

Fixed it by following dazza5000's solution. Thank you!

viplav76 commented 5 years ago

My Flutter-Android Studio can't detect the device.

Following is my flutter Doctor response -

C:\viplavBiz1\viplav_biz>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
Unhandled exception:
Exception: Android sdkmanager tool not found (C:\Users\Viplav\AppData\Local\Android\sdk\tools\bin\sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
#0      throwToolExit (package:flutter_tools/src/base/common.dart:26:3)
#1      AndroidWorkflow._ensureCanRunSdkManager (package:flutter_tools/src/android/android_workflow.dart:253:7)
#2      AndroidWorkflow.licensesAccepted (package:flutter_tools/src/android/android_workflow.dart:191:5)
<asynchronous suspension>
#3      AndroidWorkflow.validate (package:flutter_tools/src/android/android_workflow.dart:152:19)
<asynchronous suspension>
#4      Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:88:56)
#5      Doctor.diagnose (package:flutter_tools/src/doctor.dart:145:41)
#6      _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#7      Doctor.diagnose (package:flutter_tools/src/doctor.dart:135:24)
#8      DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:29:39)
#9      _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#10     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:28:42)
#11     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:356:18)
#12     _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#13     _rootRunUnary (dart:async/zone.dart:1132:38)
#14     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#15     _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#16     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
#17     Future._propagateToListeners (dart:async/future_impl.dart:671:32)
#18     Future._complete (dart:async/future_impl.dart:476:7)
#19     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#20     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
#21     _rootRun (dart:async/zone.dart:1124:13)
#22     _CustomZone.run (dart:async/zone.dart:1021:19)
#23     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#24     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#25     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#26     _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13)
#27     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
SPSpisoft commented 5 years ago

Solved for me! My problem was that my app run in console flutter run but in android studio [no device] (windows64) I did the @dazza5000 solution, But I got into trouble, because path the android-studio-dir was "space" [c:\program filse...] and this made it difficult to address and because I did not find the solution I had to change path .. Ultimately my problem is solved with {run as administrator} android studio Good luck.

yanzhenjie commented 5 years ago

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
act262 commented 5 years ago

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...

labermt commented 5 years ago

Same problem on Linux Mint.

Arxi commented 5 years ago

Had a similar problem on Xubuntu 18.04.1, Android Studio 3.2.1, Flutter 1.0.0, Dart 2.1.0.

If the Android Studio wasn't running, flutter doctor from terminal said everything is in order, flutter devices correctly showed my device and flutter run worked as expected.

As soon as I started Android Studio, flutter doctor and flutter devices intermittently show the devices and "no device". If I had flutter run running before, it was killed by starting the Android Studio with "Lost connection to device". In Android Studio, the device is intermittently shown and disappears. It was not possible to run the app from the Studio, saying the devices is not connected.

It is as if Android Studio and terminal battle for the flutter process and neither of them works correctly when Android Studio is running. Thus I had to choose between running the app, and developing the app in Studio :).

It seems it has been solved by running the command @dazza5000 suggested: flutter config --android-sdk /path/to/android-sdk from inside the terminal in Android Studio.

I don't understand why it works, as flutter doctor didn't indicate any problems with Android SDK, I have $ANDROID_HOME and PATH set up correctly, etc. Thank you @dazza5000 !

benyamin218118 commented 5 years ago

solved! thanks to the dazza5000 :D android sdk path was not setted for flutter.

onclave commented 5 years ago

This is still a problem. Cannot find connected devices in Android Studio even though flutter devices finds the device.

zoechi commented 5 years ago

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.

magnus-lpa commented 5 years ago

The only thing that worked for me was a full reboot of Windows 10.

IntelliJ just said "Loading..." in the emulator dropdown, and the "flutter" command line executable seemed to have completely stopped working, for example "flutter doctor" seemed to freeze. Couldn't find how to terminate Dart/Flutter in Taskmanager?

Ghedeon commented 5 years ago

Seems like it fails to pick up the android-sdk path, even if it's properly set in the system. Could be a very frustrating experience for people that just installed flutter.

VNAPNIC commented 5 years ago

[X] Android toolchain - develop for Android devices X Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.io/setup/#android-setup for detailed instructions). If Android SDK has been installed to a custom location, set ANDROID_HOME to that location. You may also want to add it to your PATH environment variable.

tribals commented 5 years ago

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.

Hakall commented 5 years ago

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 !

wangxinxuan commented 5 years ago

Solved for me! My problem was that my app run in console flutter run but in android studio [no device] (windows64) I did the @dazza5000 solution, But I got into trouble, because path the android-studio-dir was "space" [c:\program filse...] and this made it difficult to address and because I did not find the solution I had to change path .. Ultimately my problem is solved with {run as administrator} android studio Good luck.

If you're on windows make sure to use double quotes.

slovnicki commented 5 years ago

I believe this problem is described and solved here: https://stackoverflow.com/questions/50336530/cannot-run-flutter-app-on-android-emulator

shehry3894 commented 5 years ago

if adb devices is not showing any devices then try connecting the device manually by the following command adb connect 127.0.0.1:62001

chitwoob commented 5 years ago

Make sure USB Debugging is enabled on the phone too.

baoxiehao commented 5 years ago

I've got the same problem. The strange thing is that it was OK just minutes ago, and it doesn't show any devices now. Have tried all the above suggestions but no luck...

baoxiehao commented 5 years ago

And I just solved it by replugin the USB cable on the computer side...

artsems commented 5 years ago

https://github.com/flutter/flutter-intellij/issues/2084#issuecomment-414164342

Dazza solution worked for me.

akhilgite commented 4 years ago

iPhone simulator name was not showing coz I installed two xcode. I executed following command and it worked for me.

sudo xcode-select -s {xcode path} Eg: sudo xcode-select -s Documents/Xcode\ 11/Xcode-beta.app/

cristian64 commented 4 years ago

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.

bitristan commented 4 years ago

flutter config --android-sdk /path/to/android/sdk flutter config --android-studio-dir /path/to/android-studio-dir

I use debian 10.0.0. This work for me.

thisisgurjeet commented 4 years ago

one should update the android studio n plugin with latest version.

Krunal79-flutter commented 4 years ago

Already Solved At https://icetutor.com/question/flutter-run-no-connected-devices/

abhishekvmenon971 commented 4 years ago

Exit and start Android Studio again can solve the issue

it worked for me thank you

abdulmanum commented 4 years ago

i just kill server and start server by these commands: adb kill-server adb start-server adb show devices adb devices

And then i restart my android studio and then its showing my devices everything is perfect.

AAverin commented 4 years ago

After trying everything suggested, solved my problem differently. I have a bit tricky setup when I have a shared data partition used by 2 different OSX installs. 2 things:

blemelin commented 4 years ago

@dazza5000 workaround worked for me.

Perhaps this should be documented in the known issues of the README.md file. Something like this :


I will gladly make a pull request with this included.

anshul798 commented 4 years ago

In my case I restarted android studio and after waiting for some time IDE detected the device.

parkbsu commented 4 years ago

I noticed if I have two instances of Android Studio opened, the Flutter instance does not register the devices. Closing the other instance and the devices immediately appeared.

fancychendong commented 4 years ago

image image I have the same problem.

`PS C:\Users\lenovo> flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel master, v1.13.3-pre.41, on Microsoft Windows [Version 10.0.18362.657], locale zh-CN)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [√] Android Studio (version 3.5) [!] Android Studio X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. [!] IntelliJ IDEA Community Edition (version 2019.2) X Flutter plugin not installed; this adds Flutter specific functionality. [√] VS Code (version 1.42.1) [!] Connected device

! Doctor found issues in 3 categories.`

fancychendong commented 4 years ago

Great, i finally solved it! I replaced platform-tool with another version. https://dl.google.com/android/repository/platform-tools_r27.0.1-windows.zip So for now, it is because the high version of platform-tools is not compatible

collinsbigomba commented 4 years ago

IMG_20200327_162811_6

Help pliz It has failed to deploy the app on the phone