Reputation: 2437
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.
This is a Windows 10 x64 machine.
Installed Android Studio in - D:\Program Files\Android\Android Studio1
Installed Android SDK from Android Studio in - D:\Android\android-sdk
Set these system environment variables
ANDROID_HOME - D:\Android\android-sdk;D:\Android\android-sdk\tools;D:\Android\android-sdk\build-tools;D:\Android\android-sdk\platform-tools
ANDROID_SDK_ROOT - D:\Android\android-sdk;D:\Android\android-sdk\tools;D:\Android\android-sdk\build-tools;D:\Android\android-sdk\platform-tools
Installed Nexus 6 API 28 device & set Emulated Performance Graphics to Hardware GLES-2.0
Installed pie Android 9.0 x86
& pie Android 9.0 x86_64
as I was unsure which one to use. The AVD emulator launches fine with both the OS. (Which one to use?)
Installed flutter in - D:\Flutter\flutter
When I run main.dart, it shows this error:
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:
Upvotes: 6
Views: 17946
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
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
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
Reputation: 2437
I was able to solve this with @rgvi solution.
D:\Flutter\flutter\bin
flutter doctor
. This now showed that Android licenses status unknown.flutter doctor --android-licenses
and accepted the licenses.Upvotes: 0
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
Reputation: 26
In environment variables > User Variables, add a new PATH, like: C:\src\flutter\bin
Then restart your machine.
Upvotes: 1