sukesh
sukesh

Reputation: 2437

Android studio - flutter: No Connected Devices

I have just started with mobile development using flutter, and there is this error when trying to run the default flutter program.

No connected devices found; please connect a device, or see flutter.dev/setup for getting started instructions.

When I run main.dart, it shows this error:

enter image description here

When I run flutter doctor in the Android Studio it shows 2 issues:

[X] Android toolchain - develop for Android devices
    X ANDROID_HOME = D:/Android/android-sdk
      but Android SDK not found at this location.
[!] Connected device
    ! No devices available

When I try to run a command in powershell from the flutter directory, it gives this error:

enter image description here

Upvotes: 6

Views: 17946

Answers (6)

Surbhi
Surbhi

Reputation: 41

The easiest solution, that worked for me was this :

Go in the terminal and first run -

flutter doctor --android-licenses

If you get no error and the output is something like this :

All SDK package licenses accepted.======] 100% Computing updates...

Then check if your emulators are recognized by Android studio (enter this in the terminal):

flutter emulators

This will display the list of emulators you have added. Now enter this in your terminal

flutter emulators --launch emulator id

emulator id is the name of the emulator which you will get from the "flutter emulator" command, so the launch command should be like this :

example : flutter emulators --launch Pixel_4a_API_30

Pixel_4a_API_30 is my emulator's id or the name

as soon as you run this the emulator will launch.

This is what worked for me, hope it works for you!

Good day!

Upvotes: 4

iawegfib
iawegfib

Reputation: 101

I had a similar issue. After relocating the android sdk, you need to run this in cmd/powershell to tell flutter where the Android is:

flutter config --android-sdk "your path"

Upvotes: 3

Muhamed Riyas M
Muhamed Riyas M

Reputation: 5183

I had faced similar issue, my android studio was detecting the phone but not listing under "Flutter Device Selection".

The problem was I was not configured the Porject SDK

To set up from android studio go to

File > Project Structure > Project SDK > "available sdk" > Apply

Upvotes: 10

sukesh
sukesh

Reputation: 2437

I was able to solve this with @rgvi solution.

  1. Added new path to PATH variable - D:\Flutter\flutter\bin
  2. Executed the command flutter doctor. This now showed that Android licenses status unknown.
  3. Executed the command flutter doctor --android-licenses and accepted the licenses.

Upvotes: 0

KitsuPixel
KitsuPixel

Reputation: 21

I think the error in the powershell means you did not add the Flutter SDK to your PATH as stated in the install documentation.

First follow the install documentation to add the Flutter SDK to your PATH, then close any PowerShell windows you have.

Open an emulator.

Open a PowerShell window.

Try to create a test project via the PowerShell like so

flutter create <project name>
cd <project name>
flutter run

Upvotes: 1

rvgi
rvgi

Reputation: 26

In environment variables > User Variables, add a new PATH, like: C:\src\flutter\bin

Then restart your machine.

Upvotes: 1

Related Questions