Reputation: 15951
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?
Upvotes: 388
Views: 621710
Reputation: 484
None of the above solutions worked for me, but I was able to solve it by invalidating caches and restarting my Android Studio:
Menu File → Invalidate Caches / Restart...
EDIT:::
To clear Android Studio’s cache and bring it out of its state of confusion
select ‘File > Invalidate Caches / Restart’ and then click the ‘Invalidate and Restart’ button.
Clean and rebuild your project.
Upvotes: 4
Reputation: 1931
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.
Upvotes: 89
Reputation: 1081
Solution most times is to enable Dart support on android studio. Preferences > Languages and framework > Dart
Ensure Dart support is enabled for your flutter project.
Upvotes: 1
Reputation: 8592
None of the suggestions worked until I ran:
flutter config --android-sdk ANDROID_SDK_PATH
Use "ANDROID_SDK_PATH" = your path. For example:
flutter config --android-sdk C:\Users\%youruser%\AppData\Local\Android\Sdk
Upvotes: 57
Reputation: 1055
I encountered the same problem as you experienced. It turns out that your device is not connected to your computer. What I did was actually just
flutter emulators
then Specially perform a cold boot things will get back to their place most probably. All the Best coder.
Upvotes: 0
Reputation: 788
MacOS solution: I have scanned through all the answers and did find my solution. As far as I remember there was a problem with .bas_profile, .zshrc and other config files synchronization. So in order to make them synchronize run Android Studio from terminal, for example:
open /Applications/Android\ Studio\ 2.app
Upvotes: 0
Reputation: 1790
Android Studio -> Preferences -> Languages & Frameworks -> Dart
Make sure you enabled Dart support for the module (should be checked in)
Upvotes: 12
Reputation: 3906
I am using Linux and here are the steps that can help. First open Android Studio with root permissions, (Windows: Right-click the program icon → Choose Run As Administrator, Linux: sudo ./studio.sh
in the terminal)
Create emulator with Hardware - GLES 2.0 in hardware acceleration as mentioned here. Open a terminal in Android Studio (Alt + F12).
Run command flutter devices
and see the list devices:
root@abc-OptiPlex-3050:~/flutter_workspace/my_app/my_app# flutter devices Woah! You appear to be trying to run flutter as root. We strongly recommend running the flutter tool without superuser privileges.
1 connected device:
Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27)(emulator)
Finally run flutter run
from the terminal:
root@abc-OptiPlex-3050:~/flutter_workspace/my_app/my_app# flutter run
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
Using hardware rendering with device Android SDK built for x86.
If you get graphics artifacts, consider enabling software rendering
with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.7s
Resolving dependencies... 1.2s
Running 'gradlew assembleDebug'... 1.5s
Built build/app/outputs/apk/debug/app-debug.apk.
I/FlutterActivityDelegate(25096): onResume setting current activity to this
Syncing files to device Android SDK built for x86...
D/ (25096): HostConnection::get() New Host Connection established
0xe8487780, tid 25116
D/EGL_emulation(25096): eglMakeCurrent: 0xe5b3d8a0: ver 2 0 (tinfo 0xe84832f0)
🔥 To hot reload changes while running, press "r". To hot restart (and
rebuild state),press "R".An Observatory debugger and profiler on
Android SDK built for x86 is available at: http://127.0.0.1:8100/
For a more detailed help message, press "h". To quit, press "q".
And do check the flutter-sdk path in your project.Configure file from this answer.
Set Project SDK of project from Project Structure
File > Project Structure > Project SDK > "available sdk" > Apply
Upvotes: 15
Reputation: 79656
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.
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.
flutter devices
command to verify that Flutter recognizes your connected Android device.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.
To prepare to run and test your Flutter app on the Android emulator, follow these steps:
For details on the above steps, see Managing AVDs.
flutter run
. The connected device name is Android SDK built for <platform>, where platform is the chip family, such as x86.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.
Upvotes: 284
Reputation: 386
Basically there are three common causes for this problem:
1. You don't have the ADB drivers installed on your computer. Make sure you have the correct ADB drivers for your Android device installed on your PC.
Even if your computer reads your device, you may not have the ADB drivers installed. I recommend that you search and download the correct ADB drivers for your Android device from Google or download an ADB package. If you install an ADB and it doesn't work, try installing another ADB, as it is common that not all ADBs work.
If you're on Windows, when you've installed the correct ADB drivers, maybe the O.S. run Windows Update to complete the ADB installation.
2. Your device does not have debugger mode enabled. It depends on each version of Android. Generally, on your Android device, you have to go to the configuration menu, then open the developer options, activate the debugger mode, enable OEM unlocking and USB debugger. Also make sure you allow the developer to sign on your device
3. Incorrect cable or other physical problems.
Sometimes the problems are caused by the data transfer cable. Try using other cables.
Upvotes: 0
Reputation: 671
No one here mentions to make sure the Android device is not connected as "Media device". As soon as I turned this off and set it to "Charging", it worked.
I obviously installed the USB driver through Android Studio, and also went through a step of adding "adb" to my system path by adding the location of it to "PATH".
Upvotes: 0
Reputation: 1221
Setting the System environment variable:
Variable | Value |
---|---|
ANDROID_HOME | D:\Android_Sdk\Sdk (your path) |
Upvotes: 1
Reputation: 377
If you have already installed and set up your emulator, but you are facing the issue during running your app, you can try these steps to fix this issue.
Steps:
Note - if it's still not working, try the 4th step again by wiping your data.
Upvotes: 1
Reputation: 1387
Open the terminal in Visual Studio Code, and write the below commands:
flutter devices
flutter daemon -v
After that, connect using cmd:
cd (ADB folder)
adb tcpip 4455
adb connect 192.168.1.11:4455 (use your device IP address)
Upvotes: 1
Reputation: 359
In case you want to test you app on your physical device via Wi-Fi:
1.) Connect your device via USB (make sure developer options and USB debugging are enabled)
2.) Type in your Android Studio terminal: adb tcpip 5555
3.) Remove the USB connection
4.) Type in your Android Studio terminal: adb connect <IP address of your device>
Alternatively, you can use the Wi-Fi ADB extension for Android Studio. I don't know any similar extension for Visual Studio Code.
Upvotes: 0
Reputation: 2483
Just my case. I haven't found this solution among the answers.
System
Android 10 device.
Mac with macOS v10.14.6 (Mojave, 18G4032).
Developer options and USB debugging were enabled on my Android device.
Flutter SDK was installed on my Mac.
Problem
When the Android device had been connected to my Mac with the USB cable, the flutter devices
command still stated: No devices available
.
Solution
Fortunately, my Android device showed me the popup with the suggestion to install Android File Transfer on my Mac.
After installing the Android File Transfer on my Mac, the flutter devices
command showed my Android device as connected.
Upvotes: 0
Reputation: 75
I had the same issue. Setting up the Android SDK is also a correct answer. But this is very simple -
Upvotes: 3
Reputation: 164
Just execute the below command in a terminal before running:
open -a Simulator
Upvotes: -4
Reputation: 395
Step 1: To check the connected devices, run: flutter devices
Step 2: If there aren't any connected devices to see in the list of available emulators, run: flutter emulators
Step 3: To run an emulator, run: flutter emulators --launch <emulator id>
Step 4: If there is no available emulator, run: flutter emulators --create [--name xyz]
==> For Android:
Step 1: To check the list of emulators, run: emulator -list-avds
Step 2: Now to launch the emulator, run: emulator -avd avd_name
==> For iOS:
Step 1: open -a simulator
Step 2: flutter run
(in your app directory)
Upvotes: 5
Reputation: 3859
Check ADB is running or not. If not, run using the below command:
adb start server
And then
adb devices
If ADB is not installed in your machine, install it and run commands again.
Upvotes: 0
Reputation: 115
This is my solution.
First connect the device to the laptop and in mobile, open settings of the smartphone and search for Developer Options and click on it and enable USB Debugging on your device.
Then open the project and open the terminal and type "flutter run"
By doing so your device is recognized.
Then set up your Android Emulator.
In Android Studio, at the top, there will be no devices option. Click on that and proceed to select your device, wait for a few minutes, and you can see your app on your smartphone or on the emulator as per your selected Android emulator.
Upvotes: 0
Reputation: 5427
I recently faced the same problem. I am using macOS and the iOS simulator. The flutter devices
command shows No devices detected.
Then I run the flutter doctor
command and it says my Xcode installation is incomplete,
But it's not true (I verify it by building native iOS app and it runs well)!
I didn't reinstall/download Xcode again. I just ran those two commands according to their suggestions:
sudo xcode-select --switch /Applications/Xcode.app/Contacts/Developer
sudo xcodebuild -runFirstLaunch
And it solves my problem. Here is the final flutter doctor
command output.
Upvotes: 0
Reputation: 1008
If you are using Windows, press Control + Alt + Delete and select Dart Task inside Android Studio and click End Task.
I tried many times, and it works.
Upvotes: 0
Reputation: 1253
NOTE: I am using a Mi (Xiaomi) mobile (Redmi K20 Pro) which is running on Android 10
You need to do two things to show your device listing.
Go to your Android Studio, menu → File → Project Structure and choose the project SDK from the options. I chose the latest one from the menu.
When you connect your real device to your PC/laptop, make sure you choose Transfer photos (PTP) mode.
NOTE: Don't choose File transfer mode. It will not work.
After doing the above two things, you can check the status of your device availability by writing flutter devices
on the command prompt.
I hope it shows your mobile device.
Upvotes: 3
Reputation: 1411
I was using Visual Studio Code on a Mac and was trying to run the Flutter code on my iPhone. The device was not showing up in the status bar. I fixed the issue by doing this in the Terminal:
rm -rf <flutter_repo_directory>/bin/cache
flutter doctor -v
This will basically clear all the cache data from the Flutter repository folder. So when you run flutter doctor it will download some files initially.
Upvotes: 2
Reputation: 658
You could try
flutter emulators
to show a list of already-created emulators.
Today, this shows me the two emulators in the list below.
Nexus_6_API_27 • Nexus 6 API 27 • Google • android
Pixel_2_API_27 • Pixel 2 API 27 • Google • android
You can then use something like
flutter emulators --launch Nexus_6_API_2
to start the emulator of choice
You can then use flutter run
to test your app.
I use Visual Studio Code and tend to do use this approach which saves me having to load Android Studio to launch an emulator.
Upvotes: 2
Reputation: 601
While using it in Windows 7, I had received an error: unable to install device drivers. And the device wasn't recognised.
You need to also install the Android OEM device driver for the particular device, just like mentioned here.
I downloaded the driver for the device from the manufacturer's website and installed the driver from Device Manager.
Upvotes: 0
Reputation: 3152
In my case
Menu File → Project Structure
Select the latest SDK:
Upvotes: 38
Reputation: 2409
Use:
flutter config --android-sdk ANDROID_SDK_PATH
Or
Upvotes: 229