Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pcdinh opened this issue Apr 13, 2018 · 56 comments

Comments

@pcdinh
Copy link

pcdinh commented Apr 13, 2018

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
@pcdinh
Copy link
Author

pcdinh commented Apr 13, 2018

Exit and start Android Studio again can solve the issue

@pq
Copy link
Contributor

pq commented Apr 13, 2018

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

Thanks for the report!

@stevemessick
Copy link
Member

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
Copy link

edman commented Jun 7, 2018

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
Copy link

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
Copy link

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

@Cxuef
Copy link

Cxuef commented Jul 4, 2018

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
Copy link

ojhero commented Jul 6, 2018

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

@TheHasnatBD
Copy link

I have the same problem on Ubuntu

@dazza5000
Copy link

Experiencing this on Ubuntu

@Kamil-H
Copy link

Kamil-H commented Aug 8, 2018

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
Copy link

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
Copy link

mamert commented Aug 14, 2018

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
Copy link

dazza5000 commented Aug 19, 2018

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
Copy link

gliheng commented Aug 31, 2018

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

@viplav76
Copy link

viplav76 commented Sep 11, 2018

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
Copy link

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
Copy link

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
Copy link

act262 commented Nov 17, 2018

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
Copy link

labermt commented Dec 7, 2018

Same problem on Linux Mint.

@Arxi
Copy link

Arxi commented Dec 28, 2018

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
Copy link

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

@onclave
Copy link

onclave commented Jan 28, 2019

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

@slovnicki
Copy link

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

@shehry3894
Copy link

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
Copy link

Make sure USB Debugging is enabled on the phone too.

@baoxiehao
Copy link

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
Copy link

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

@artsems
Copy link

artsems commented May 31, 2019

#2084 (comment)

Dazza solution worked for me.

@akhilgite
Copy link

akhilgite commented Jun 19, 2019

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
Copy link

cristian64 commented Jul 23, 2019

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
Copy link

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
Copy link

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

@Krunal79-flutter
Copy link

@abhishekvmenon971
Copy link

Exit and start Android Studio again can solve the issue

it worked for me thank you

@abdulmanum
Copy link

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
Copy link

AAverin commented Feb 17, 2020

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:

  • looks like dart and fluttter have problems accessing files that belong to user from another system even if all permissions are set on the files correctly. Dart often fails with "unable to set last modification timestamp on file". So just do sudo chown -R ${whoami} project_folder
  • make sure your Android folder in flutter projects has synced it's gradle configuration. Open gradle settings in Android Studio and manually sync gradle.

@blemelin
Copy link

@dazza5000 workaround worked for me.

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


  • If your device is connected, but does not show itself in the Device dropdown, try running this command in a terminal, replacing $ANDROID_HOME with the path to your Android SDK directory : flutter config --android-sdk $ANDROID_HOME. Also, make sure the flutter SDK directory is in your PATH beforehand.

I will gladly make a pull request with this included.

@anshul798
Copy link

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

@parkbsu
Copy link

parkbsu commented Mar 6, 2020

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
Copy link

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
Copy link

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
Copy link

collinsbigomba commented Mar 27, 2020

IMG_20200327_162811_6

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

@sozay
Copy link

sozay commented Apr 9, 2020

after closing the emulator, wiping out the android emulator on AVD worked for me.

@premraval-pr
Copy link

Was facing the same issue.
Solution by @dazza5000 worked smoothly for me.

@shaileshBhokare
Copy link

shaileshBhokare commented Aug 15, 2020

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

@ahmedaniss25
Copy link

problem fixed here : https://youtu.be/TjQpLYz3kSE

@exeptionerror

This comment was marked as spam.

@kcbaruri
Copy link

I am facing the same problem in a specific flutter project and other flutter project can identify the devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests