Message "flutter run: No connected devices"

465,090

Solution 1

Flutter supports both iOS and Android device/simulators.

In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.

Here is a reference document on how you can set up a device/simulator to run your application.

For, Android (on a Mac system)

Set up your Android device

To prepare to run and test your Flutter app on an Android device, you’ll need an Android device running Android 4.1 (API level 16) or higher.

  1. Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
  2. Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
  3. In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
  4. Start your app by running flutter run.

By default, Flutter uses the version of the Android SDK where your ADB tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_HOME environment variable to that installation directory.

Set up the Android emulator

To prepare to run and test your Flutter app on the Android emulator, follow these steps:

  1. Enable VM acceleration on your machine.
  2. Launch Android Studio → menu ToolsAVD Manager and select Create Virtual Device.
  3. Choose a device definition and select Next.
  4. Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
  5. Under Emulated Performance, select Hardware - GLES 2.0 to enable hardware acceleration.
  6. Verify the AVD configuration is correct, and select Finish.

For details on the above steps, see Managing AVDs.

  1. In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.
  2. Start your app by running flutter run. The connected device name is Android SDK built for <platform>, where platform is the chip family, such as x86.

Open & Connect Device using Android Studio:

Here is an easier way to open and connect simulators/devices.

Android Studio shows a list of emulators/simulators (installed in your system) or devices (connected to your system). Just select a device you want to open from a list, and run the project.

Enter image description here

Solution 2

Use:

flutter config --android-sdk ANDROID_SDK_PATH

Or

  • Device Not Found (when setting up Flutter in Android Studio)
  • Project structure -> select latest Android API in Project SDK

Enter image description here

Solution 3

This was my solution:

My "Developer Options" was ON, but the "USB Debugging" was OFF.

So I turned ON the USB Debugging and the problem was solved.

Solution 4

None of the suggestions worked until I ran:

flutter config --android-sdk ANDROID_SDK_PATH

Use "PATH" = your path. For example:

flutter config --android-sdk C:\Users\%youruser%\AppData\Local\Android\Sdk

Solution 5

I solved the AVD problem with Flutter using the Flutter console.

Step 1:

C: \ Users \ valer> flutter emulators
6 available emulators:

3.2_QVGA_ADP2_API_22 _-_ Lollipop • 3.2in QVGA (ADP2) • Generic • 3.2 QVGA (ADP2) API 22 - Lollipop
Android_ARMv7a
Android_Accelerated_x86
Nexus S API Google Nexus S API 23
Nexus_S_API_25_1080x1920_Nougart_7.1.1_ • pixel • Google • Nexus S API 25 1080x1920 (Nougart 7.1.1)
Pixel_API_28 • pixel • Google • Pixel API 28

To run an emulator, run flutter emulators --launch <emulator id>.

Step 2:

C: \ Users \ valer> flutter emulators --launch Pixel_API_28
Share:
465,090
PULL STACK DEV
Author by

PULL STACK DEV

Full-time freelance Full-stack Developer. Hire me at [email protected]

Updated on July 08, 2022

Comments

  • PULL STACK DEV
    PULL STACK DEV almost 2 years

    I am trying to create a sample application with Flutter (fresh installation). Android Studio is also installed (fresh installation).

    Here is the output of flutter run

    flutter run
    No connected devices.
    

    The output of flutter doctor:

    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel beta, v0.1.5, on Linux, locale en_US.UTF-8)
    [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    [✓] Android Studio (version 3.0)
    [!] VS Code (version 1.20.1)
    [!] Connected devices
    ! No devices available
    
    ! Doctor found issues in 2 categories.
    

    Is there a solution to this problem?

  • Dan
    Dan almost 6 years
    Thanks. I reinstalled Genymotion and had to do this.
  • abjbhat
    abjbhat over 5 years
    I can't get this to work. The emulator runs just fine. I can deploy and run an Android application to it. But the flutter project from Android studio keeps complaining that there's no emulator.
  • Roberto Góes
    Roberto Góes over 5 years
    Genymotion isis lighter.
  • olisteadman
    olisteadman about 5 years
    Same here, I get "No connected devices found; please connect a device, or see flutter.io/setup for getting started instructions." Meanwhile I can see the emulator sitting there on the same screen, up & running.
  • pipedreambomb
    pipedreambomb about 5 years
    I've had the same issue, where VS Code can run Flutter but terminal can't. I wonder if there's an argument I'm missing that would make it work? It doesn't seem to make sense; I think VS Code or XCode commands would just serve as front ends for the CLI.
  • sanjana
    sanjana almost 5 years
    in my case i havent launched emulator .once launching emulator u can run the app
  • nurulhudamustaqim
    nurulhudamustaqim almost 5 years
    {SOLVED} After a while I did an trial n error, I know exactly this problem is caused by corrupted adb file (by default "flutter devices" will call the "adb" file provided by the SDK, for example my adb.exe file exists in "C:\Android\Sdk\platform-tools "). the way to overcome this problem is to replace the file with the other adb file (make sure you have done a previous backup), you can replace your original adb with my adb file that you can download at the following link: gofile.io/?c=c0M3DC. Thanks
  • Shirish Kadam
    Shirish Kadam almost 5 years
    By setting both the Project SDK and Module SDK fixed it. Thanks.
  • Mahdi-Malv
    Mahdi-Malv almost 5 years
    This solved my issue. I had running devices, but flutter was not able to detect them.
  • John Franke
    John Franke over 4 years
    should be open -a Simulator && flutter run
  • Richard
    Richard over 4 years
    what about ios on mac? I have several macs and my 2012 MBA (USB-A) will only make the connection available if itunes is running. Connecting the same device to my 2019 MBA (USB-C) flutter does not recognize the device even though iTunes does,
  • Richard
    Richard over 4 years
    My 2012 Macbook Air with USB-A can detect my iPhone5 but ONLY if I start iTunes. My 2019 Macbook Air with USB-C cannot detect the same iPhone5 (yes, trusted, and yes works in XCode and iTunes). My android phone works on both systems (no iTunes), however, on the 2019 MBA I need a USB-A/C dongle.
  • Pulller
    Pulller over 4 years
    My iPhone can't recognize by flutter on the mac system. tried many ways, yours works well.Thanks~
  • pedro_bb7
    pedro_bb7 over 4 years
    After doing that got unable to locate Android SDK
  • 1cedsoda
    1cedsoda over 4 years
    Worked for me. No SDK was selected
  • NearHuscarl
    NearHuscarl over 4 years
    On Windows 10 I had to restart my computer before it works
  • essbee
    essbee over 4 years
    @eggrobot78 was able to address this by adding the Android SDK installation location as an environment path variable for ANDROID_HOME.
  • Wilmer
    Wilmer over 4 years
    if there is no option project structure, restart android studio
  • Damyan Todorov
    Damyan Todorov about 4 years
    Solution for me about iOS: I had 2 Xcodes and by default, the android studio was pointing to 11.4 but it was opening the simulator from 11.3 (with lower version), I just opened a new simulator with version 11.4 and Android studio detected it.
  • NullByte08
    NullByte08 almost 4 years
    So you have to open the emulator first and then start build process of the project. Why cant they work simultaneously in flutter like normal android project?
  • Moberg
    Moberg over 3 years
    Do I need the Android SDK to run flutter on a connected device?
  • Fellow7000
    Fellow7000 over 3 years
    Thanks a lot! Looks like this happens if you just clone the project from version control, so the environment is not setup automatically.
  • Peter Mortensen
    Peter Mortensen about 3 years
    All: What is the explanation?
  • Peter Mortensen
    Peter Mortensen about 3 years
    ..AndroidStudioSDK\sdk does not appear to be correct. Should it be ..\AndroidStudioSDK\sdk? Please respond (as approproate) by editing your answer, not here in comments (without "Edit:", "Update:", or similar - the answer should appear as if it was written today).
  • Peter Mortensen
    Peter Mortensen about 3 years
    "Nougart"? Shouldn't it be Nougat? Was this the actual output (it already seems to have been manipulated)?
  • Peter Mortensen
    Peter Mortensen about 3 years
    What do you mean by "invalidating catch"? Can you elaborate?
  • Peter Mortensen
    Peter Mortensen about 3 years
    What do you mean by "I put flutter there before"?
  • Peter Mortensen
    Peter Mortensen about 3 years
    Is the purpose of listing the emulators to get an emulator ID? Or something else? Can you make it more clear in your answer? Can you provide an example of an emulator ID? What does "it" refer to in "to build it"? What is built? Please respond by editing your answer, not here in comments (without "Edit:", "Update:", or similar - the answer should appear as if it was written today).
  • Peter Mortensen
    Peter Mortensen about 3 years
    What do you mean by "changing "ANDROID_HOME" to the Environment variables"? Can you elaborate? Please respond by editing your answer, not here in comments (without "Edit:", "Update:", or similar - the answer should appear as if it was written today).
  • Peter Mortensen
    Peter Mortensen about 3 years
    By "PATH", do you mean "ANDROID_SDK_PATH"? Or something else? Can you elaborate? Please respond by editing your answer, not here in comments (without "Edit:", "Update:", or similar - the answer should appear as if it was written today).
  • Peter Mortensen
    Peter Mortensen about 3 years
    Is "Simulator" literal?
  • Peter Mortensen
    Peter Mortensen about 3 years
    Presumably for Windows?
  • Jude Okoroafor
    Jude Okoroafor about 3 years
    By "Invalidate Catches" you'll be removing the virtual file system cache together with the information stored in Local History. This action might be helpful for troubleshooting purposes as the IDE caches information about your project’s structure.
  • crazyProgrammer
    crazyProgrammer about 3 years
    In some cases the operative system installs automatically the ADB drivers
  • Vivek Gupta
    Vivek Gupta almost 3 years
    open -a Simulator The above command will open iOS Simulator from mac Terminal
  • Shafkhan
    Shafkhan almost 3 years
    This won't solve the problem above. This will open a simulator on a Mac machine.