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

35

82

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.

Evoy answered 14/4, 2019 at 17:4 Comment(2)
flutter emulators to see available devicesSkelly
1. Restart 'terminal' windows 2. Restart Android Studio, stop emulator, wipe data, run again 3. Make sure you are getting some output or error in terminal windows, if not start with step 1 and 2.Monster
A
85

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!!

Assignment answered 4/4, 2020 at 16:30 Comment(5)
If you is using linux, you should give the user permission from the directory /dev/kvm.Revivalism
I'd same problem and "Cold Boot Now" option works fine. No need to wipe device data.Soccer
I killed qemu process from task manager :D seems easierRateable
Wipe data worked for me. Here is a tutorial that visually shows where those options are on latest version of Android Studio: How to fix flutter failed to launch emulator errorCoaly
In my case, I had to remove all my virtual device, close android studio, reboot my computer, create a new virtual device, and then the emulator started working again. Prior to that fix, the "idea.log" had the warning: Unable to determine if Pixel_6_API_29 is online, assuming it's not. That error would not go away until I did the steps I mentioned above. And yes, I did try "Wipe Data" and "Cold Boot Now" and that didn't help. Also closing Android Studio and restarting it did not help. Rebooting Windows seemed to be a necessary step.Hyracoid
P
18

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

Prager answered 2/7, 2019 at 17:31 Comment(0)
M
18

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
Meter answered 23/7, 2021 at 13:40 Comment(0)
P
10

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.

Pridgen answered 25/5, 2020 at 15:0 Comment(1)
yah just setting path variables didn't work for me. you have to set 'ANDROID_HOME'Inchworm
B
9

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
Brinson answered 2/5, 2021 at 11:59 Comment(0)
P
6

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.
Pongee answered 13/10, 2021 at 1:17 Comment(2)
worked well for me when other solutions couldn'tAgostino
Where do you run the command (2)? My standard windows terminal does not know adb.Cartomancy
E
4

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.

Excited answered 14/4, 2019 at 20:9 Comment(1)
It doesn't say any devices are connected despite having like 5 emulators.Evoy
S
4

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.
Siderite answered 28/1, 2021 at 22:53 Comment(2)
I also had a problem with disk space but VS Code doesn't display a clear error message that directs us to the root cause. What worked for me was trying to start the emulator manually through "flutter emulators --launch flutter_emulator" and I managed to see the root cause. Use "flutter emulator" in order to see the available emulator ids to use with the launch command.Gangrel
because some answers mixed with free space case, actually this is maybe woking but if still not working maybe you should try another answerZendah
D
2

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

Dremadremann answered 29/7, 2019 at 8:9 Comment(0)
M
2

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

Musgrave answered 25/4, 2020 at 12:35 Comment(1)
I'm not sure why this was marked down? For anyone else like me who could not get the emulator to start - it would hang at the popup loading screen about 30% through and the qemu process would also hang - this was the solution. In my case I didn't have HAXM installed at all.Hop
F
2

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 .

Formaldehyde answered 10/8, 2020 at 20:36 Comment(0)
B
2

Try restarting your PC once! It worked for me!

Bollard answered 30/8, 2020 at 20:36 Comment(2)
This could have been a comment on the question, not an answer.Thorson
This is a valid answer. While not an ideal solution, this is the only thing that currently works for me whenever VS Code fails to connect to the emulator, with the message "Emulator didn't connect within 60 seconds"Newsman
P
2

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.

Particularize answered 20/1, 2021 at 16:56 Comment(2)
Why can't flutter launch hardware accelerated devices?Hewart
@PatrickGeyer In general Flutter can and does, this just happened to be an issue. I haven't had this problem myself in some time now.Particularize
H
2

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.

Holmann answered 21/2, 2021 at 8:5 Comment(0)
P
2

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

Poppyhead answered 29/4, 2021 at 9:22 Comment(0)
C
1

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.

Consumptive answered 7/4, 2020 at 16:52 Comment(0)
W
1

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!

Windsail answered 30/3, 2021 at 9:8 Comment(0)
M
1

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

Mopes answered 26/2, 2022 at 8:42 Comment(0)
C
1

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.
Charmion answered 7/3, 2022 at 21:13 Comment(0)
S
1

Make sure that vt-x is enabled in your bios

Shope answered 8/3, 2022 at 20:9 Comment(0)
C
1

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.

Cesarean answered 20/10, 2022 at 13:8 Comment(0)
D
0

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.

Duelist answered 8/5, 2020 at 11:55 Comment(0)
A
0

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.

Afeard answered 10/5, 2020 at 20:18 Comment(0)
H
0

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.

Hosanna answered 22/11, 2020 at 13:7 Comment(0)
A
0

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.

Assentor answered 14/12, 2020 at 17:32 Comment(0)
H
0

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.

Hbeam answered 31/1, 2021 at 9:26 Comment(0)
S
0

delete AVD and create a new one worked for me.

Seychelles answered 13/9, 2021 at 19:50 Comment(0)
N
0

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.

Nellienellir answered 22/1, 2022 at 22:5 Comment(0)
I
0

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

Illfated answered 24/2, 2022 at 19:13 Comment(0)
W
0

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.

Wiltonwiltsey answered 26/6, 2022 at 8:59 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewQuillon
C
0

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

Columella answered 24/7, 2022 at 2:22 Comment(0)
T
0

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.

Torse answered 3/8, 2022 at 17:31 Comment(0)
K
0

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

Kempe answered 19/9, 2022 at 5:14 Comment(0)
C
0

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

Commodus answered 17/2, 2023 at 23:55 Comment(0)
B
0

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.
Boiardo answered 12/10, 2023 at 11:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.