Search code examples
androidflutterandroid-studioandroid-emulatoradb

Android Studio: "Unable To Locate ADB" and emulator screen goes wrong , Flutter


I've tried to run my android studio emulator, but pop up "Unable to locate adb" always appear on my screen and after that my emulator was in crash. I've tried to delete and make new emulator, but I've got the same result. Can some one help me about this problem?

strong textUnable To Locate ADB

my pc specification


Solution

  • Deployment Issues

    Verify that the Android SDK can connect to your emulator. To verify emulator connectivity, use the following steps:

    1.Launch the emulator from the Android Device Manager (select your virtual device and click Start).

    2.Open a command prompt and go to the folder where adb is installed. If the Android SDK is installed at its default location, adb is located at C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe; if not, modify this path for the location of the Android SDK on your computer.

    3.Type the following command in shell:

    adb devices
    

    4.If the emulator is accessible from the Android SDK, the emulator should appear in the list of attached devices. For example:

    List of devices attached
    emulator-5554   device
    

    Hardware acceleration issues

    5.If the emulator does not appear in this list enter the following command:

    "C:\Program Files (x86)\Android\android-sdk\emulator\emulator-check.exe" accel
    

    (You can verify that hardware acceleration is enabled and which acceleration method the emulator is using.Whether you are using Hyper-V or HAXM for hardware acceleration, you may run into configuration problems or conflicts with other software on your computer.)

    This command assumes that the Android SDK is installed at the default location of C:\Program Files (x86)\Android\android-sdk; if not, modify the above path for the location of the Android SDK on your computer.

    Hardware acceleration not available

    If Hyper-V is available, a message like the following example will be returned from the emulator-check.exe accel command:

    HAXM is not installed, but Windows Hypervisor Platform is available.
    

    If HAXM is available, a message like the following example will be returned:

    HAXM version 6.2.1 (4) is installed and usable.
    

    Hyper-V issues

    In some cases, enabling both Hyper-V and Windows Hypervisor Platform in the Turn Windows features on or off dialog may not properly enable Hyper-V. To verify that Hyper-V is enabled, use the following steps:

    6.Enter powershell in the Windows search box.

    7.Right-click Windows PowerShell in the search results and select Run as administrator.

    8.In the PowerShell console, enter the following command:

    Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online
    

    If Hyper-V is not enabled, a message similar to the following example will be displayed to indicate that the state of Hyper-V is Disabled:

    FeatureName      : Microsoft-Hyper-V-All
    DisplayName      : Hyper-V
    Description      : Provides services and management tools for creating and running virtual machines and their resources.
    RestartRequired  : Possible
    State            : Disabled
    CustomProperties :
    

    9.In the PowerShell console, enter the following command:

    Get-WindowsOptionalFeature -FeatureName HypervisorPlatform -Online
    

    If the Hypervisor is not enabled, a message similar to the following example will be displayed to indicate that the state of HypervisorPlatform is Disabled:

    FeatureName      : HypervisorPlatform
    DisplayName      : Windows Hypervisor Platform
    Description      : Enables virtualization software to run on the Windows hypervisor
    RestartRequired  : Possible
    State            : Disabled
    CustomProperties :
    

    10.If Hyper-V and/or HypervisorPlatform are not enabled, use the following PowerShell commands to enable them:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
    Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform -All
    

    After these commands complete, reboot. Now try to run your Android Studio Emulator.