Failed to launch emulator: Error: Emulator didn't connect within 60 seconds

AndroidIosFlutterVisual Studio-CodeEmulation

Android Problem Overview


I'm unable to debug using VSCode for Flutter. I'm using Windows and I'm trying to use an Android emulator.

I have attempted to reinstall Flutter, Android SDK and VSCode to fix the issue, as well as tried setting environment variables.

This is the error that I get when launching debug mode. Failed to launch emulator: Error: Emulator didn't connect within 60 seconds

Are there any better emulators that I can use for both Android and IOS, because I don't even know where to begin with IOS emulators. I'm new to app development and want to get started making applications for both devices.

Android Solutions


Solution 1 - Android

i had same problem, i tried to stopping emulator based on Answer of Rahul Shukla:

> Steps: > > Open Android Studio > Tools -> AVD Manager > Virtual Device -> Actions (Refer Image) > Click On Stop > Now Start Emulator > Now it's working fine :)

but it not work for me. i test another way. i use these steps:

  • Open Android Studio Tools -> AVD Manager Virtual Device -> Actions Click On Wipe data

Now Start Emulator and Enjoy it!!

Solution 2 - Android

Steps:

  1. Open Android Studio
  2. Tools -> AVD Manager
  3. Virtual Device -> Actions (Refer Image)
  4. Click On Stop
  5. Now Start Emulator

Now it's working fine :)

enter image description here

Solution 3 - Android

I've added a user environment variable:

  • Name: ANDROID_HOME

  • Path: Your android folder path, personally it was D:\Android

and restart.

Hope it ll work for you.

Solution 4 - Android

enter image description here

  1. Open Android studio and go to AVD manager.
  2. Click on stop
  3. Click on wipe data
  4. Click Cold boot

Solution 5 - Android

Adding the following variables to $HOME/.bash_profile solved my problem

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

Solution 6 - Android

For android emulator there are alternatives like geanny motion.

Since you have AVD installed you could try running from the command line. run flutter devices to get the list of emulators and their id. then run (assuming emulator-5554 is you emulator id) flutter run -v -d emulator-5554

Finally you the option of starting android studio then start your emulator,form the IDE and the run the above command or you even run the app from the IDE.

Solution 7 - Android

This is what worked for me. In Android Studio, go to Settings, and select HAXM. Then go to Tools, AVD Manager, and click on the Play button to start your emulator.

enter image description here

Also, make sure you have enabled Hardware Acceleration in your BIOS, if you have not done so yet. Check this post for this matter: https://stackoverflow.com/questions/21635504/error-during-installing-haxm-vt-x-not-working

Solution 8 - Android

Approach of wiping data listed above worked for me , i mentioned those in steps :- Steps:

1.Open Android Studio 2.Tools -> AVD Manager 3.Virtual Device -> Actions 4.Click On wipe data 5.Now Start Emulator 6.Now restart the pc

Restarting the pc is not necessary i just did it as a follow-up, although make sure your android studio is updated because in my case AS was not updated so i think my emulator was not working and VS Code was throwing errors .

Solution 9 - Android

Try restarting your PC once! It worked for me!

Solution 10 - Android

I am using Genymotion 3.0.2., VS Code (version 1.36.1)

You can read about it here - Using Genymotion Emulator with Flutter in VS Code — (Without Android Studio)

Open up Genymotion and go to the ADB Setting section:

Notice how the default selection is “Use Genymotion Android Tools (default)”? With this selection, the emulator is not recognized. genymotion ADB settings

Change it to “Use custom Android SDK tools”, set the SDK location to where your SDK is (in my case it’s at “C:\Program Files (x86)\Android\android-sdk”). Make sure the tick mark (“This folder is valid”) is displayed.

Close the settings box. Now reload your “VS Code” IDE. Emulator now displayed in vs code

Solution 11 - Android

The problem for me was that Intel HAXM wasn't installed. When I opened AVD Manager through Android Studio and tried to launch the emulator from there (instead of trying through VS Code), it told me that HAXM was required and prompted me to install it. After Android Studio installed HAXM successfully, I could run the emulator from VS Code without any issues.

Solution 12 - Android

I had the same issue on Linux. I resolved it by disabling hardware acceleration for the emulator:

Android Studio -> AVD Manager -> Edit emulator -> Emulated Performance: Changed from Hardware to Software.


Update:

It turns out that while Flutter is unable to launch emulators with hardware acceleration, they launch with acceleration just fine from Android Studio or with the emulator command.

As of April 2020 you can override emulator launch commands for Flutter in VS Code.

In VS Code settings you can search for dart.flutterCustomEmulators, or directly populate your settings.json like so:

settings example

You can get the emulator ID with the flutter emulators command:

enter image description here

Now when you choose this emulator in VS Code it will use the emulator command from the Android SDK rather than the flutter emulator command it usually uses, and it launches and connects successfully as expected.

Solution 13 - Android

Here are the reasons I had

  1. Out of disk space.
  2. Android Studio didn't launch. I immediately started looking for the problem in VS.

Solution 14 - Android

You can try to wipe the data of the particular device.

Go to -> Android Studio -> Tools -> AVD Manager -> [Select the down triangle on your chosen device] -> Wipe data.

Now retry.

Solution 15 - Android

For anyone struggling even after trying with the other solutions. Try:

  1. Quit VS Code
  2. Open your terminal and run adb kill-server
  3. Open VS Code again and attempt to run your app on your emulator.

Solution 16 - Android

For me "wipe data" by going into :

  • Android Studio
  • Configure
  • AVD Manager
  • Wipe Data

Didn't work.

So I did it the hard way :

  • Delete the emulator
  • Create a new one.
  • You should increase the internal memory of your device.

Solution 17 - Android

You need to first install android studio.

Follow these steps (Works for Android Studio 3.5.1)

  • Choose "Run" in the top menu bar

  • Press on "Select Device"

  • Select "AVD manager"

  • There will be a popup now for creating your virtual device.

Solution 18 - Android

For me, it was "Not enough disk space". Generally, in these situations, you can run Android studio then Tools-> AVD manager and start manually.

If there is a issue then you can see the actual in android studio logs.

Solution 19 - Android

Mine was similar but for iOS and it said Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds . I closed all instances of VS Code, opened the project again and this time it worked.

Solution 20 - Android

I also had the same problem above when i freshly install AVD API28. I tried all posted solutions in this thread and they didn't work for me.

So, I go to android studio --> AVD manager --> Click the green play button(Launch this AVD in the emulator).

then VSCode can detect the emulator and it works fine.

But, I think it will need to run AVD manually every time we wants to use the emulator.

Solution 21 - Android

I am encountering the same problem with the emulator that it is not starting and says:

> "Emulator didn't connect"

Solution:

> Make sure that your virtual technology (Vf-x) is enabled in the bios > setting.

This solves my problem.

Solution 22 - Android

For me, this was happening quite often and cleaning cache was a bit hectic for me as I had to download few files again and again.

What I did was, stopped the AVD from Android Studioenter image description here

Then, I ran flutter run from VS-Code and it worked!

Solution 23 - Android

Just restart the PC, works every time. It is that simple.

Solution 24 - Android

delete AVD and create a new one worked for me.

Solution 25 - Android

For some, it might be problem of the emulator and Android API itself. A duplication of the problem mention in https://stackoverflow.com/questions/55171897/can-launch-but-not-connect-to-emulator-in-vs-code-and-android-studio-using-flu?rq=1. I sort it using a API 29 instead of 30. Since API 30 (in Pixel 4) skipped the allow debug mode. Hope it helps for some of you.

Solution 26 - Android

It was a storage issue for me. Had to clear up space by deleting junk files and I was able to restart my emulator.

Solution 27 - Android

Check if it already running. Find qemu-system-x86_64 (or similar) on windows task manager, choose end task. Try launch it again.

Solution 28 - Android

Make sure that vt-x is enabled in your bios

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionf1t3View Question on Stackoverflow
Solution 1 - AndroidHossein VejdaniView Answer on Stackoverflow
Solution 2 - AndroidRahul ShuklaView Answer on Stackoverflow
Solution 3 - AndroidBligView Answer on Stackoverflow
Solution 4 - AndroidCharles Arko-ClaymanView Answer on Stackoverflow
Solution 5 - AndroidCode4ArtView Answer on Stackoverflow
Solution 6 - AndroidkennView Answer on Stackoverflow
Solution 7 - Androidlive-loveView Answer on Stackoverflow
Solution 8 - AndroidGagan JindalView Answer on Stackoverflow
Solution 9 - AndroidBenyamin BeyzaieView Answer on Stackoverflow
Solution 10 - AndroidCompilerView Answer on Stackoverflow
Solution 11 - AndroidNathanView Answer on Stackoverflow
Solution 12 - AndroidMerrittView Answer on Stackoverflow
Solution 13 - AndroidO KView Answer on Stackoverflow
Solution 14 - AndroidVictor CislariView Answer on Stackoverflow
Solution 15 - AndroidgyosidaView Answer on Stackoverflow
Solution 16 - AndroidJulien JmView Answer on Stackoverflow
Solution 17 - AndroidAsh SinghView Answer on Stackoverflow
Solution 18 - AndroidPayam KhaninejadView Answer on Stackoverflow
Solution 19 - AndroidGwamaka CharlesView Answer on Stackoverflow
Solution 20 - AndroidHtetView Answer on Stackoverflow
Solution 21 - AndroidAbd ur RehmanView Answer on Stackoverflow
Solution 22 - AndroidAajinkya SinghView Answer on Stackoverflow
Solution 23 - AndroidNandan WewhareView Answer on Stackoverflow
Solution 24 - AndroidMarkView Answer on Stackoverflow
Solution 25 - AndroidMarcoFerreiraView Answer on Stackoverflow
Solution 26 - AndroidVenkatesh AView Answer on Stackoverflow
Solution 27 - AndroidRydeView Answer on Stackoverflow
Solution 28 - AndroidRickyView Answer on Stackoverflow