Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Emulator didn't connect within 60 seconds #2773

Closed
MaisGurbanov opened this issue Sep 6, 2020 · 27 comments
Closed

Error: Emulator didn't connect within 60 seconds #2773

MaisGurbanov opened this issue Sep 6, 2020 · 27 comments
Labels
awaiting info Requires more information from the customer to progress stale Will be closed soon if no response.

Comments

@MaisGurbanov
Copy link

When I am trying to launch an Android emulator through the VS Code, I am receiving the following error:

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

Below is the output for "flutter doctor -v" command outside of the VS Code:

[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale en-US)
• Flutter version 1.20.3 at /Users/mais.gurbanov/Flutter
• Framework revision 216dee60c0 (5 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/mais.gurbanov/Android/sdk
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/mais.gurbanov/Android/sdk
• Java binary at:
/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.9.3

[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).

[✓] VS Code (version 1.48.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.14.0

[!] Connected device
! No devices available

"Flutter: Run Flutter Doctor" command's output inside of the VS Code:

[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale en-US)
• Flutter version 1.20.3 at /Users/mais.gurbanov/Flutter
• Framework revision 216dee60c0 (5 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/mais.gurbanov/Android/sdk
• Platform android-28, build-tools 28.0.3
• Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.9.3

[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.48.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.14.0

[!] Connected device
! No devices available

I can launch an emulator through the terminal by executing the "emulator -avd flutter_emulator" command and it launches successfully. Then VS Code also detects that emulator and displays it in the devices bar at the bottom part.

@rasreee
Copy link

rasreee commented Sep 6, 2020

same here, but for iOS - don't really care for Android.

My error in VSCode Debug Console looks like:
Exception attempting to connect to the VM Service: SocketException: OS Error: Connection refused, errno = 61, address = 127.0.0.1, port = 58050

flutter doctor -v output (outside VSCode):
[✓] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.6 19G2021, locale en-US)
• Flutter version 1.20.2 at /Users/lesleychang/flutter
• Framework revision bbfbf1770c (3 weeks ago), 2020-08-13 08:33:09 -0700
• Engine revision 9d5b21729f
• Dart version 2.9.1

[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.9.3

[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).

[✓] Connected device (1 available)
• iPhone SE (2nd generation) (mobile) • A541E5E1-2779-43BF-B517-C57732240F6D
• ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7 (simulator)

My emulator works - doesn't matter what device I use (saying this b/c someone mentioned using iPhone SE is relevant b/c it's not new enough?).

I've made sure to:

  • add Google-Service.plist by right-clicking Runner and Add Files... in the ios/Runner XCode workspace
  • uncommenting platform number 13.0 in Podfile
  • running pod repo update
  • losing my mind w/ a bunch of other attempts i'll try to remember everything i've tried...

@DanTup
Copy link
Member

DanTup commented Sep 7, 2020

@MaisGurbanov when you launch the emulator from VS Code and get this message, do you see the emulator launch and appear? If so, does it show up in flutter devices once it is loaded? (The output of flutter doctor you posted says no connected devices, but it's not clear if you ran it after launching the emulator). Could you try capturing a log using the Dart: Capture Logs command (you can untick Analysis Server, but leave everything else ticked).

@rasreee this seems like a different problem with a different message, could you file a separate issue and also include a log captured with the above command? Thanks!

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Sep 7, 2020
@github-actions
Copy link

github-actions bot commented Oct 8, 2020

This issue has been marked stale because it is tagged awaiting-info for 30 days with no activity. Remove the stale label or comment to prevent the issue being closed in 10 days.

@github-actions github-actions bot added the stale Will be closed soon if no response. label Oct 8, 2020
@VicCislari
Copy link

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.

@vtongcoder
Copy link

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.

This one works well for me

@Blackjack1974
Copy link

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.

It worked for me too, thank you.

@aajinkya1203
Copy link

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.

This does works but it keeps happening often. Any permanent fix on this?

@exeptionerror

This comment was marked as spam.

@lukertaylor
Copy link

I'm working on a MacBook Air with M1 processor. If I run the iPhone Simulator, I can successfully use it in VSCode for debugging a Flutter app.

But I cannot get VSCode to connect to the Android Emulator. The Emulator launches when I choose to Start Pixel 3 API S. But I then get the error "Error: Emulator didn't connect within 60 seconds".

Any thoughts on how to get VSCode to connect to the Android Emulator from a Mac with M1 processor?

@DanTup
Copy link
Member

DanTup commented Jul 4, 2021

@lukertaylor does the Android emulator show up when you run flutter devices from a terminal after starting it?

@lukertaylor
Copy link

Thanks for responding so quickly Danny.

`1 connected device:

Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

• Device emulator-5554 is offline.`

Screenshot 2021-07-04 at 12 31 27

@lukertaylor
Copy link

And if I start the iOS Simulator, I get:

`luke@Lukes-MacBook-Air ~ % flutter devices
2 connected devices:

iPhone 12 Pro Max (mobile) • 92D4EACC-982F-45CE-8AA2-33312D303A32 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
Chrome (web) • chrome •
web-javascript • Google Chrome 91.0.4472.114

• Device emulator-5554 is offline.`

@DanTup
Copy link
Member

DanTup commented Jul 5, 2021

@lukertaylor

• Device emulator-5554 is offline

That looks like the problem. VS Code gets the device information from Flutter, so if Flutter believes the device is offline it won't provide it to us.

There are a few reports of this in the Flutter issue tracker you might want to read through to see if any of their solutions work (for example this one). Hope that helps!

@lukertaylor
Copy link

Thanks Danny. I've got it sorted now. There were two things I needed to do:

  1. kill the process running on 5554 (https://stackoverflow.com/questions/3152681/android-emulator-5554-offline/26423404#26423404)
  2. downgrade the emulator from release 3 to release 2 (https://stackoverflow.com/questions/67230200/emulator-appearing-offline-on-m1-mac-after-the-last-update-of-arm64-v8a)

@DanTup
Copy link
Member

DanTup commented Jul 5, 2021

Great, glad you sorted it!

@harguilar
Copy link

I am having the same issue above which I still cannot get rid of in vscode. Below is my flutter doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.2-0.0.pre.1, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-ZA)
• Flutter version 2.2.2-0.0.pre.1 at /Users/admin/developer/flutter
• Framework revision 8fec9bc028 (2 days ago), 2021-07-06 23:42:40 +0100
• Engine revision 0fdb562ac8
• Dart version 2.13.1

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/admin/Library/Android/sdk
• Platform android-30, build-tools 29.0.3
✗ Android SDK file not found: /Users/admin/Library/Android/sdk/platforms/android-30/android.jar.
• Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0

[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.7 19H524 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

! Doctor found issues in 1 category.

@DanTup
Copy link
Member

DanTup commented Jul 8, 2021

@harguilar have you tried any of the suggestions above, or confirmed that the device shows up in flutter devices?

@harguilar
Copy link

Hi @DanTup,
Thanks for the quick reply, I tried the above suggestions, when I run flutter devices I only see the below devices:
macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.7 19H524 darwin-x64
Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
However, if I run flutter emulators
4 available emulators:

apple_ios_simulator • iOS Simulator • Apple • ios
Android_ARMv7a_Nougat • Android ARMv7a Nougat • • android
Android_Accelerated_Nougat • Android Accelerated Nougat • • android
Nexus_6_API_R • Nexus 6 API R • Google • android

I see all the above ones. But When I tried to run then I get the error as the title of this tread.

@DanTup
Copy link
Member

DanTup commented Jul 8, 2021

flutter emulators shows emulators that have not been started, so it's expected they'd show up there.

If the device isn't showing in flutter devices, that will be why VS code isn't detecting it - VS code is using Flutter's device list to tell when a device finishes starting up.

I would probably try deleting the emulator and recreating it through Android Studio, and see if that makes any difference (launch it from Android Studio and then see if that shows up in flutter devices).

@alimirmohammad
Copy link

Thanks Danny. I've got it sorted now. There were two things I needed to do:

  1. kill the process running on 5554 (https://stackoverflow.com/questions/3152681/android-emulator-5554-offline/26423404#26423404)
  2. downgrade the emulator from release 3 to release 2 (https://stackoverflow.com/questions/67230200/emulator-appearing-offline-on-m1-mac-after-the-last-update-of-arm64-v8a)

Thank you so much man! I've been stuck at this for 3 days.
The downgrade did the job for me!
Finally I have a working Android emulator with Flutter on my M1 macbook pro.

@lukertaylor
Copy link

Hey @alimirmohammad, really glad you got it sorted. Thanks go to @DanTup who helped me out.

Good luck with your Flutter development!

@JSebastianOspina
Copy link

Thanks Danny. I've got it sorted now. There were two things I needed to do:

  1. kill the process running on 5554 (https://stackoverflow.com/questions/3152681/android-emulator-5554-offline/26423404#26423404)
  2. downgrade the emulator from release 3 to release 2 (https://stackoverflow.com/questions/67230200/emulator-appearing-offline-on-m1-mac-after-the-last-update-of-arm64-v8a)

Have the same Issue, follow the steps you provided and everything works fine!! thanks for sharing the solution

@labcerouno
Copy link

@lukertaylor's workaround did the trick, but... does anybody at flutter team know that?

@AlemsegedT
Copy link

It launches the emulator but displays the Failed to launch Pixel 2 XL API 25: Error: Emulator didn't connect within 60 seconds

@DanTup
Copy link
Member

DanTup commented Dec 29, 2021

@AlemsegedT after it's started, does it show up if you run flutter devices from the terminal?

@AlemsegedT
Copy link

AlemsegedT commented Dec 30, 2021 via email

@MGBarri
Copy link

MGBarri commented Mar 2, 2022

@VicCislari fix worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting info Requires more information from the customer to progress stale Will be closed soon if no response.
Projects
None yet
Development

No branches or pull requests