51

I'm trying to add a virtual phone to the device list, however, the device list is stuck on loading.

StuckLoading

I use the default nexus 5 device on AVD:

AVDConfiguration

I am on Windows 10 and trying to set up Flutter.

MendelG
  • 14,885
  • 4
  • 25
  • 52
Léo Coletta
  • 1,099
  • 2
  • 12
  • 24

34 Answers34

59

Quick fix on Android Studio:

  1. Search anywhere -> (Shift+Shift )
  2. Look for -> Restart Flutter Daemon

enter image description here

MendelG
  • 14,885
  • 4
  • 25
  • 52
Ashish
  • 609
  • 1
  • 5
  • 4
37

Go to File -> Invalidate Caches / Restart... -> Invalidate and Restart worked for me.

Image of Android Studio

MendelG
  • 14,885
  • 4
  • 25
  • 52
Biruk Telelew
  • 1,161
  • 7
  • 13
31

If you have stored your Flutter SDK in Local Disk C, then move it to another (Non-Admin Location) disk and then try using Android studio

Alternatively: Simply run your Android Studio as Administrator and it will work fine (Although running flutter with Admin privileges is not recommended nor required either)! I spent 3 hrs looking for a solution and suddenly realized this option and it worked for me

MendelG
  • 14,885
  • 4
  • 25
  • 52
jashgopani
  • 565
  • 7
  • 13
26

In my case, it was a faulty adb execution that was running in the background.

The only thing that worked for me was:

  • Close Android Studio
  • Kill adb process (on Task Manager on Windows)
  • Open Android Studio
Gabriel Gava
  • 571
  • 4
  • 10
8

Just run adb devices from command prompt while Android Studio is on.

Android Studio will handle the rest.

  • 3
    Weirdly this isn't the case in my experience. adb devices shows the device, but Android Studio is still stuck on "Loading Devices". – kas May 16 '21 at 19:32
8

After hours of searching, this is what I found.

flutter doctor -v

I found that there were some SDK certificates that weren't agreed.

flutter doctor --android-licenses

Allowed me to see which agreements that weren't agreed. After that it worked. I hope this works for you.

Mark
  • 3,389
  • 2
  • 28
  • 52
Eric Youn
  • 81
  • 1
  • 1
7

Try reinstalling Flutter and/or resetting the Flutter SDK path under "File > Settings > Languages and Frameworks > Flutter".

Noodles
  • 3,888
  • 2
  • 20
  • 31
4

Its 100% worked for me

step 1- turned OFF your Wi-Fi

step 2- open C:\Users\abcdcomputer\AppData\Local\Android\Sdk\platform-tools

enter image description here

step 3- open command prompt from in this folder

enter image description here

step 4- type " adb disconnect " command in Command prompt

enter image description here

step 5- restart android studio

Adnan Bashir
  • 645
  • 4
  • 8
3

In the path where Flutter is installed, delete the files "flutter.bat.lock" and "lockfile" and restart. enter image description here

MendelG
  • 14,885
  • 4
  • 25
  • 52
Y.elinx
  • 271
  • 3
  • 8
1
  • Make sure you have Power Shell 5.1 or greater (You can run this command to check $PSVersionTable.PSVersion
  • Update Flutter, Dart and Android studio then restart Android Studio
MSaudi
  • 4,442
  • 2
  • 40
  • 65
1

run "flutter clean" on the terminal works for me

1

After running

flutter doctor -v

I found out that my ANDROID_SDK_ROOT was not set. Setting it to the correct directory and restarting Android Studio solved the issue for me.

Mark
  • 3,389
  • 2
  • 28
  • 52
1

With New Android Studio and New Flutter, I try to Refresh a few times and it's working.

enter image description here

Doan Bui
  • 3,572
  • 25
  • 36
1

I can resolve this by running following commands in command line.

$ adb kill-server
cannot connect to daemon at tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine actively refused it. (10061)

yes it will throw an error and it means we are good to go

then you should call following command so the adb stuff start to work again

adb devices
0

Anyone using macOS, please don't download/upgrade to 1.17.4 of flutter sdk (using with with android studio/intellij). Keep yourself to 1.17.3 even if you are planning for an upgrade . Seems like intellij plugin has bugs with 1.17.4 and i wasted 2-3hrs debugging things until my eyes fell on this thread: https://github.com/flutter/flutter-intellij/issues/3892

Vinayak Shenoy
  • 405
  • 3
  • 9
0

If you are using MacOS, then there are issues with flutter version 1.17.4.
Downloading an older version helped for me.

m02ph3u5
  • 3,022
  • 7
  • 38
  • 51
0

I had the same issue. Installed Flutter again and issue was fixed

0

Upgrading to latest version by clicking flutter upgrade and then going to File-> Invalidate Caches /Restart then press Invalidate and Restart worked for me

iosdev1111
  • 1,048
  • 1
  • 13
  • 32
0

if nothing worked then try this : Download a new and stable version of Flutter SDK from here , point path of your flutter sdk from settings > search flutter > point path to new downloaded sdk > invalidate cache and restart. you are done !

Shafqat Nadeem
  • 184
  • 1
  • 1
  • 9
0

The problem for me was that ADB was excluded from the Antivirus, so I've simply added an exception for the ADB and the problem was solved

0

This may happen if you have cloned an app and the Flutter and Dart paths have not been set. Delete the ".idea" folder and set the paths and if there are any connected devices, they will load automatically.

Tim Kariuki
  • 633
  • 8
  • 17
0

On Windows, I fixed the issue by putting the Android SDK in the PATH. I guess the Flutter plugin internally uses ADB to know the attached devices, so if you don't have it in your path, nothing can be done.

If that's your case, just type adb on a terminal. If it doesn't work, it means you have to put your Android SDK in the path, so you (and the Flutter plugin) can use it.

Just adding a screenshot just to clarify it a bit.

enter image description here

Roc Boronat
  • 11,395
  • 5
  • 47
  • 59
0

For me the issue seems to be that my anti-virus program identified dart.exe as a threat and renamed it to dart.exe.000 - what worked for me was -

  1. I downloaded the dart sdk and replaced the directory in my flutter directory 2) deleted flutter/bin/cache/flutter_tools.stamp 3) ran flutter doctor ...and then it worked
0

Solved For Me With:

  1. Update flutter Plugin

  2. File => Invalidate Caches / Restart => Invalidate and Restart

  3. Update Android Studio

  4. Update SDK

  5. Install SDK in Only default Location android Studio

  6. Tools => Troubleshoot Device Connection & read this and continue to Troubleshoot.

  7. Use (RunAsAdmin(Windows) / root USER(Linux)) FOR RUN

  8. if you use physical Device , use code IN TERMINAL LINUX {

sudo apt update
sudo apt install adb

and Check if your Device Connected

adb devices

}

0

I was using another runtime, so I had to Ctrl+Shift+A -> Choose Runtime -> Default

Maxim Mazurok
  • 3,856
  • 2
  • 22
  • 37
0

In your Terminal, run:

flutter upgrade

and restart Android Studio.

MendelG
  • 14,885
  • 4
  • 25
  • 52
0

Check this

Project Structure->Project settings-> project->Project SDK setting

For me the project sdk was not set. After selecting the android sdk for the project, "loading devices" option is gone.

https://github.com/flutter/flutter-intellij/issues/5031#issuecomment-838640744

RayBacker
  • 166
  • 1
  • 2
  • 12
0

Kill the flutter processes from running first, taskkill /F /IM dart.exe in your terminal in android studio then type
flutter run. in the terminal again and press enter.

Afterwards your device you start showing.

0

None of the answers on this page works for Apple M1 cpus. On Apple M1 chips the adb command does not work because it is not built for the Apple silicon. So that needs to be translated first to be runnable on the Apple chip. This is what Rosetta 2 does. To install it manually you can do this in the terminal (Thanks to this answer):

softwareupdate --install-rosetta

followed by

invalidate cache and restart

Ali Nem
  • 5,252
  • 1
  • 42
  • 41
0

Just Restart your laptop/desktop.

Saurabh Padwekar
  • 3,888
  • 1
  • 31
  • 37
0

On Ubuntu I used

adb kill-server

This fixed the problem.

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
Abd Alazeez
  • 126
  • 1
  • 5
0

For me solution is

I have moved project from one Machine/Computer to another Machine, so Dart path was wrong.

So I have updated Dart path as per new location in new machine.enter image description here

Ashvin
  • 8,227
  • 3
  • 36
  • 53
-1

Running Android Studio as Administrator (Windows) / Super User (Linux) fixed the issue for me.

Proko
  • 1,871
  • 1
  • 11
  • 23
-1

I spent a full day trying to solve this issue. Finally, I located and deleted my SDK folder then downloaded new SDK platforms and tools via SDK TOOLS. Everything is working fine now.

Marsad
  • 859
  • 1
  • 14
  • 35