f1t3
f1t3

Reputation: 891

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

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.

Upvotes: 89

Views: 380853

Answers (30)

Ralph B.
Ralph B.

Reputation: 13

Here's what worked for me:

I ensured all paths in my environment variables are set correctly. I had an issue with my SDK paths containing a space.

What I also did:

I toggled Hyper-V off and then on again: (If you use Hyper-V)

- Go to 'Control Panel' > 'Programs' > 'Turn Windows features on or off'.
- Uncheck 'Hyper-V', click 'OK', and restart.
- Re-enable 'Hyper-V' and restart again.

Upvotes: 0

Thiago Silva
Thiago Silva

Reputation: 796

Something got wrong with the image saved. Just select "Start emulator with coldboot" in VS code for a fresh restart and will work.

Upvotes: 0

Samier Shovo
Samier Shovo

Reputation: 148

I had the same issue. For me it was low space on C drive. After I cleared some space on C drive, it worked just fine.

Upvotes: 1

Akshay K
Akshay K

Reputation: 91

Goto AVD manager and delete old virtual device and install new Device then it will work.

Upvotes: 2

Khaireddine Mejri
Khaireddine Mejri

Reputation: 101

You have multiple devices that are taking a lot of disk space, just delete the ones that you don't need and retry launching your emulator, everything should work fine. you got that error cuz you run out of space with all those emulators.

Upvotes: 0

greeneley
greeneley

Reputation: 117

Follow these steps:

  1. Find qemu-system-x86_64on Task Manager and end task
  2. Open cmd and execute this command adb kill-server

It works for me. Good luck

Upvotes: 0

Mert Durukan
Mert Durukan

Reputation: 108

I am using Lenovo V15 laptop. I chose extreme performance from bios settings. And I encountered this error. When I select intelligent cooling, the problem was solved.

In a nutshell, Replace 'extreme performance' with 'intelligent cooling' in the bios.

Upvotes: 0

Born Ready
Born Ready

Reputation: 3526

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.

Upvotes: 0

Ricky
Ricky

Reputation: 71

Make sure that vt-x is enabled in your bios

Upvotes: 1

Ryde
Ryde

Reputation: 714

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

Upvotes: 2

Venkatesh A
Venkatesh A

Reputation: 2504

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

Upvotes: 0

MarcoFerreira
MarcoFerreira

Reputation: 378

For some, it might be problem of the emulator and Android API itself. A duplication of the problem mention in Can launch, but not connect, to emulator in VS Code and Android Studio using flutter. 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.

Upvotes: 0

gyosida
gyosida

Reputation: 460

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.

Upvotes: 6

Mark
Mark

Reputation: 380

delete AVD and create a new one worked for me.

Upvotes: 0

Code4Art
Code4Art

Reputation: 801

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

Upvotes: 18

Charles Arko-Clayman
Charles Arko-Clayman

Reputation: 336

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

Upvotes: 10

Nandan Wewhare
Nandan Wewhare

Reputation: 525

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

Upvotes: 2

Aajinkya Singh
Aajinkya Singh

Reputation: 713

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!

Upvotes: 1

Victor Cislari
Victor Cislari

Reputation: 21

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.

Upvotes: 2

Abd ur Rehman
Abd ur Rehman

Reputation: 173

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.

Upvotes: 0

O K
O K

Reputation: 141

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.

Upvotes: 4

Merritt
Merritt

Reputation: 574

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.

Upvotes: 2

Htet
Htet

Reputation: 7

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.

Upvotes: 0

Gwamaka Charles
Gwamaka Charles

Reputation: 1695

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.

Upvotes: 0

Benyamin Beyzaie
Benyamin Beyzaie

Reputation: 573

Try restarting your PC once! It worked for me!

Upvotes: 2

Gagan Jindal
Gagan Jindal

Reputation: 21

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 .

Upvotes: 2

live-love
live-love

Reputation: 52454

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: Error during installing HAXM, VT-X not working

Upvotes: 2

Blig
Blig

Reputation: 101

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.

Upvotes: 10

Payam Khaninejad
Payam Khaninejad

Reputation: 7996

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.

Upvotes: 0

Ash Singh
Ash Singh

Reputation: 4847

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.

Upvotes: 0

Related Questions