Android Studio with Flutter doesn't see emulator

4,410

This could happen if the Flutter plugin does not find the location of the Android SDK. We need to tell Flutter the location of Android SDK explicitly.

Set the ANDROID_HOME environment variable to the SDK path.

For Windows: In Android Studio, get path from : Apprearance & Behaviour > System Settings > Android SDK > Android SDK path

Note: Make sure the path doesn't contain any spaces.

Then run this:

flutter config --android-sdk {path}
flutter doctor --android-licenses

If this doesn't work, check other workaround in this GitHub post.

Share:
4,410
user11655900
Author by

user11655900

Updated on December 22, 2022

Comments

  • user11655900
    user11655900 over 1 year

    When I run Android Studio emulator through "Tools > AVD Manager > Click on run button next to device" and wait until it boots Android Studio still says no device connected. Also when I click on run button in the top right corner of the main Android Studio window to run the default Flutter code instead of running the app on the emulator it shows this error(while I have the emulator running):

    enter image description here

    When I run "flutter devices" in the cmd it says:

    Running different Flutter commands in the cmd

    D:\project\Flutter projects\first_app>flutter devices

    No devices detected.

    Run "flutter emulators" to list and start any available device emulators.

    If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the --timeout flag. Visit https://flutter.dev/setup/ for troubleshooting tips.

    • Device emulator-5554 is not authorized. You might need to check your device for an authorization dialog.

    When I run "flutter emulators" in the cmd it says:

    D:\project\Flutter projects\first_app>flutter emulators

    1 available emulator:

    Pixel_2_API_28 • Pixel 2 API 28 • Google • android

    To run an emulator, run 'flutter emulators --launch '. To create a new emulator, run 'flutter emulators --create [--name xyz]'.

    You can find more information on managing emulators at the links below: https://developer.android.com/studio/run/managing-avds
    https://developer.android.com/studio/command-line/avdmanager

    It doesn't matter if the emulator is running or not the responses to the commands above are the same in both cases.

    Running "flutter doctor":

    D:\project\Flutter projects\first_app>flutter doctor 
      
    Doctor summary (to see all details, run flutter doctor -v): 
    
    [√] Flutter (Channel
     stable, v1.17.3, on Microsoft Windows [Version 10.0.18362.900], locale
     ru-RU)
     
    [!] Android toolchain - develop for Android devices (Android SDK
     version 30.0.0)
         
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor -->android-licenses 
    
    [√] Android Studio (version 3.6) 
    
    [!] Connected device
     
    ! Doctor found issues in 2 categories.
    

    When I run "flutter run" with a running emulator it says:

    D:\project\Flutter projects\first_app>flutter run

    No supported devices connected.

    Environmental variables

    My environmental variables related to Android Studio are so:

    Both user and system variables have:

    ANDROID_HOME = D:\Programs\AndroidSDK

    ANDROID_SDK_HOME = D:\Programs\AndroidSDK\Home

    ANDROID_SDK_ROOT = D:\Programs\AndroidSDK

    ANDROID_AVD_HOME = D:\Programs\AndroidSDK\Home.android\avd

    "Path" in both system and user variables contains:

    %ANDROID_HOME%\platform-tools

    %ANDROID_HOME%\tools

    Genymotion

    I have tried using Genymotion. I have lost all my hope in it and stopped using it when it responded with error window during first launch attempt.

    Other forum answers

    I have followed many answers from different forums. So:

    I have my "Windows Hypervision Platform"(I think its alternative name is "Hyper-V") turned off. Intel VT-X is turned on in the BIOS settings. Memory Integrity is turned off in the Windows Defender, and I don't have any other anti-viruses than Windows Defender. I have tried running "adb kill-server" and then "adb start-server" to restart the server. I don't have VPN. Once I read that port-consuming applications may cause the problem, so I have XAMPP but I don't use it. I have "adb.exe" file in the "platform-tools" folder of Android SDK directory. I have tried reinstalling SDK platform tools. I have changed user name so it has only English characters and is without spaces but with capitals, it helped a bit.

    SDK Tools and SDK Platforms

    I have Android API 30.0 and Android 9.0 SDK platforms, Android SDK Platform-Tools, Android Emulator, Intel x86 Emulator Accelerator (HAXM installer), Android SDK Command-line Tools, Android Build-Tools 28.0.3 and Android Build-Tools 30.0.0 installed.

    The emulator setup I use

    My emulator has Android Pie version 9.0 API level 28 x86. The graphics parameter in the Emulated Performance section was "Automatic" when I was creating the device because I can't change it: when I click on the dropdown box nothing happens.

    My PC

    OS: Windows 10 x64.

    CPU: Intel Core i3 6100U.

    Device type: Laptop.

    System type: x64.

    Discreet GPU: NVIDIA GeForce 920MX.

    Integrated GPU: Intel HD Graphics 520.

    Android Studio: 3.6.3 (but I have tried using 4.0).

    Android SDK and Android Studio itself are installed on non-system disk - disk D (HDD). While the disk C (SSD) is the system disk.

    Other problems with the emulator

    The emulator(and Android Studio itself) is very very laggy. Also it usually throws "X application is not responding" error from time to time and on boot. The application in the error is system application such as: UI, Launcher and etc.


    I can't give up on the programming branch just because of some small problem at the beginning of the path, also I have purchased a course.

    Thanks in advance for helping!