Flutter / Technology · 2022年8月17日

Can’t attach iOS simulator in Android Studio

Using iOS simulator in Android Studio is straightforward –

  1. Install X-Code (with Simulator)
  2. Make sure you run the command sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  3. Make sure you run the command sudo xcodebuild -license
  4. Open Simulator
  5. Open Android Studio
  6. Should see the ios simulator in the dropdown box

However, I hit a weird situation where the iOS simulator can start successfully but the option can’t be shown in the dropdown box in Android Studio.


Checkpoint #1

The Command Line Tools in XCode preference has been set correctly.

Open your XCode and go to Preference -> Locations. Inside this tab, under locations, you will see one option of Command line tools. If nothing is selected here, click on it and select the installed command line tools.

Checkpoint #2

Recheck the xcode path has been set correctly. xcode-select -p

Checkpoint #3

Check Xcode version

The reason I put it last is that *ideally* you should have a correct version of Xcode when you install it.

However, sometimes the version of Android Studio requires a different version of Xcode than you have. It happens when your software is up-to-date but your OS is NOT up-to-date.

In my case, I recognize it by running flutter doctor, and even flutter is complaining about a newer version of Xcode.