Dart-code: Start iOS Simulator Not Shows in VS Code after updating Flutter 1.22

Created on 2 Oct 2020  Â·  21Comments  Â·  Source: Dart-Code/Dart-Code

Describe the bug
When running flutter application on Mac VS Code, it was prompt asking Start iOS Simulator or Create Android Simulator. Once we select iOS Simulator it will simply open XCode Simulator. After New Update the device option shows only Create Android Emulator.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Devices in the Bottom Bar of VS Code'
    OR
  2. Cmnd+shft+P then choose Start Emulator

Expected behavior
It should show Start iOS Simulator & Create Android Emulator both options.

Screenshots
image

Versions (please complete the following information):

  • VS Code version: 1.49.2
  • Dart extension version: 3.15.0
  • Dart/Flutter SDK version: 1.22
fixed in dart / flutter

Most helpful comment

Yep, that's the issue. There's a bug in Flutter where this request is failing when there is no Android SDK. An Android SDK should not be required, but this bug means that it currently is.

If you set up an Android SDK, it'll resolve the issue. Otherwise, a future update to Flutter will include the fix I linked above that should make it work without.

Hope this makes sense!

All 21 comments

Can you post the full output of flutter doctor -v? I've seen this happen if your Xcode is out of date (https://github.com/flutter/flutter/issues/42751 / https://github.com/flutter/flutter/pull/42254) but it was almost a year ago I hit that.

If it's not that, please check your project has an ios folder, and post the full output of flutter devices -v. Thanks!

[✓] Flutter (Channel stable, 1.22.0, on Mac OS X 10.15.4 19E2269, locale en-GB)
    • Flutter version 1.22.0 at /Users/Shared/Dev/flutter
    • Framework revision d408d302e2 (3 days ago), 2020-09-29 11:49:17 -0700
    • Engine revision 5babba6c4d
    • Dart version 2.10.0

[✗] 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 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • 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).

[!] IntelliJ IDEA Ultimate Edition (version 2020.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

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

[!] Connected device
    ! No devices available

! Doctor found issues in 4 categories.

Once i stated the simulator using XCode, its appears as below. But previously i could start iOS Simulator from here as well.

Screenshot 2020-10-02 at 11 44 36 PM

@Safnaj if you close down the simulator and restart VS Code, does it show up again now you've run it once? (I've seen some issues where I had to run Xcode once after an update before everything worked correctly).

I checked by restarting VS Code, XCode and the Mac

@DanTup Any solutions ?

@Safnaj do you have an ios folder in your project?

Could you post the output of running flutter emulator -v and also the following:

  • Run the Dart: Capture Logs command
  • Untick Analysis Server but leave everything else ticked and click OK
  • Click the device selector on the status bar to open the popup
  • Click Cancel on the logging notification to open the log
  • Paste the log here

Thanks!

Output of flutter emulator -v

safnaj@Safnajs-MacBook-Pro ~ % flutter emulator -v
[ +129 ms] executing: [/Users/Shared/Dev/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +44 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] d408d302e22179d598f467e11da5dd968dbdc9ec
[        ] executing: [/Users/Shared/Dev/flutter/] git tag --points-at HEAD
[  +14 ms] Exit code 0 from: git tag --points-at HEAD
[        ] 1.22.0
           1.22.0-12.3.pre
[  +10 ms] executing: [/Users/Shared/Dev/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +5 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/Users/Shared/Dev/flutter/] git ls-remote --get-url origin
[   +5 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +40 ms] Unable to locate an Android SDK.
[   +7 ms] executing: [/Users/Shared/Dev/flutter/] git rev-parse --abbrev-ref HEAD
[   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[   +5 ms] executing: sw_vers -productName
[  +17 ms] Exit code 0 from: sw_vers -productName
[        ] Mac OS X
[        ] executing: sw_vers -productVersion
[  +15 ms] Exit code 0 from: sw_vers -productVersion
[        ] 10.15.4
[        ] executing: sw_vers -buildVersion
[  +15 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 19E2269
[  +49 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[   +7 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[  +52 ms] "flutter emulators" took 77ms.
[   +5 ms] Unable to find any emulator sources. Please ensure you have some
           Android AVD images or an iOS Simulator available.
[   +1 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      EmulatorsCommand.runCommand (package:flutter_tools/src/commands/emulators.dart:37:7)
           #2      FlutterCommand.verifyThenRunCommand
(package:flutter_tools/src/runner/flutter_command.dart:972:18)
           #3      _rootRunUnary (dart:async/zone.dart:1198:47)
           #4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #8      Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #9      Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #10     _rootRun (dart:async/zone.dart:1190:13)
           #11     _CustomZone.run (dart:async/zone.dart:1093:19)
           #12     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #13     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #14     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #16     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)


[ +279 ms] ensureAnalyticsSent: 276ms
[   +1 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[   +1 ms] exiting with code 1

Output of Dart: Capture Logs

!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.15.0
Flutter extension: 3.15.0 (activated)

App: Visual Studio Code
Version: 1.49.2
Platform: mac

Workspace type: Flutter
Analyzer type: DAS
Multi-root?: false

Dart SDK:
    Loc: /Users/Shared/Dev/flutter/bin/cache/dart-sdk
    Ver: 2.10.0
Flutter SDK:
    Loc: /Users/Shared/Dev/flutter
    Ver: 1.22.0

HTTP_PROXY: undefined
NO_PROXY: undefined

Sat Oct 03 2020 [17:30:29 GMT+0530 (India Standard Time)] Log file started
[5:31:59 PM] [General] [Info] Checking 1 projects for supported platforms
[5:31:59 PM] [FlutterDaemon] [Info] ==> [{"id":"4","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"/Users/safnaj/Documents/SLIIT/Research/2020-103/Emotely"}}]
[5:31:59 PM] [FlutterDaemon] [Info] <== [{"id":"4","result":{"platforms":["ios","android"]}}]
[5:31:59 PM] [General] [Info] Supported platforms for the workspace are ios, android
[5:31:59 PM] [FlutterDaemon] [Info] ==> [{"id":"5","method":"emulator.getEmulators"}]
[5:31:59 PM] [FlutterDaemon] [Info] <== [{"id":"5","error":"NoSuchMethodError: The getter 'emulatorPath' was called on null.\nReceiver: null\nTried calling: emulatorPath","trace":"#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)\n#1      AndroidEmulators._getEmulatorAvds (package:flutter_tools/src/android/android_emulator.dart:59:45)\n#2      AndroidEmulators.emulators (package:flutter_tools/src/android/android_emulator.dart:55:43)\n#3      EmulatorManager.getAllAvailableEmulators.<anonymous closure> (package:flutter_tools/src/emulator.dart:81:41)\n#4      Future.forEach.<anonymous closure> (dart:async/future.dart:512:26)\n#5      Future.doWhile.<anonymous closure> (dart:async/future.dart:554:26)\n#6      _rootRunUnary (dart:async/zone.dart:1198:47)\n#7      _CustomZone.runUnary (dart:async/zone.dart:1100:19)\n#8      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)\n#9      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1042:26)\n#10     _rootRunUnary (dart:async/zone.dart:1198:47)\n#11     _CustomZone.runUnary (dart:async/zone.dart:1100:19)\n#12     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)\n#13     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)\n#14     Future._propagateToListeners (dart:async/future_impl.dart:725:32)\n#15     Future._completeWithValue (dart:async/future_impl.dart:529:5)\n#16     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)\n#17     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)\n#18     EmulatorManager.getAllAvailableEmulators.<anonymous closure> (package:flutter_tools/src/emulator.dart)\n<asynchronous suspension>\n#19     EmulatorManager.getAllAvailableEmulators.<anonymous closure> (package:flutter_tools/src/emulator.dart)\n#20     Future.forEach.<anonymous closure> (dart:async/future.dart:512:26)\n#21     Future.doWhile.<anonymous closure> (dart:async/future.dart:554:26)\n#22     _rootRunUnary (dart:async/zone.da…
[5:31:59 PM] [General] [Error] NoSuchMethodError: The getter 'emulatorPath' was called on null.
Receiver: null
Tried calling: emulatorPath
Sat Oct 03 2020 [17:32:03 GMT+0530 (India Standard Time)] Log file ended

@DanTup

@DanTup seems something missing in my logs.

It looks like there's a bug in the latest Flutter that would failt o return any emulators when the Android SDK is missing. I've filed a bug at https://github.com/flutter/flutter/issues/67293 and a PR to fix at https://github.com/flutter/flutter/pull/67295.

I'm not sure of any workaround in the meantime except setting up an Android SDK.

Ohh.. Actually I didn't setup Android SDK. I run and test apps fully on iOS environment

Yep, that's the issue. There's a bug in Flutter where this request is failing when there is no Android SDK. An Android SDK should not be required, but this bug means that it currently is.

If you set up an Android SDK, it'll resolve the issue. Otherwise, a future update to Flutter will include the fix I linked above that should make it work without.

Hope this makes sense!

Thanks & Waiting for the update 😊

The fix has landed in Flutter's master channel so closing this. It may take some times to work its way through the other channels of course.

@DanTup is this issue going to be fixed in next release ??

@Safnaj the issue was fixed in Flutter. I would expect it to be in the next major Flutter release, but I don't know when that is (I think there has just been a stable release so it might a little way off). As a workaround in the meantime, you could set up an Android SDK to prevent the issue (which could just be the command line tools, or enough to pass the doctor checks).

The fix has landed in Flutter's master channel so closing this. It may take some times to work its way through the other channels of course.

Screenshot 2021-01-04 at 11 46 20 AM

no device in master channel as well.

@avinashk369 is there an ios folder in your project? If not, can you try running flutter create . in your project to create it (I've opened #3045 to make this easier in future).

If you do, could you enable the Flutter Daemon log and provide the output in a new issue (I don't think it's the same as this issue).

Thanks!

@DanTup Sometime VSCODE suddenly stops showing the iOS devices, It gets fixed after some time automatically. I don't know what is the issue

@iampawan the issue noted above was fixed in Flutter but hasn't made the stable branch yet. However it's unlikely to be intermittent (it's based on whether you have an Android SDK). If you can reproduce another issue, please try enabling the flutter daemon log and next time you see it, grab a copy of that log and file a new issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jascodes picture jascodes  Â·  4Comments

rajeshjeshar picture rajeshjeshar  Â·  4Comments

CaferPoyrazoglu picture CaferPoyrazoglu  Â·  4Comments

shamrin picture shamrin  Â·  5Comments

agmcleod picture agmcleod  Â·  3Comments