Uchenna F. Okoye
Uchenna F. Okoye

Reputation: 1036

Flutter : Not Connecting to IOS Simulator in Android Studio

I am following the Flutter Test Drive tutorial on the Flutter Docs. I installed XCode, cocoapods, ran pods setup etc.

However, in Android Studio, when I try to run IOS by clicking "Run IOS Simulator," it opens the simulator but fails to connect.

I also tried doing this from the terminal. Opened an IOS emulator and then ran flutter run in the app folder in terminal. I got an error No devices attached.

Upvotes: 75

Views: 54933

Answers (12)

Elias Ayele
Elias Ayele

Reputation: 67

if you have downloaded the beta version of xcode you can use this command, and your problem will go away.

sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer

Upvotes: 0

Chandrashekar Ollala
Chandrashekar Ollala

Reputation: 747

This error showed up after I updated my Xcode.

  1. Open Terminal
  2. Run the following command in Terminal

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

  1. Enter your device's password.

Your IDE (Android Studio or IntelliJ) will detect the IOS Simulator as soon as you click return.

Upvotes: 18

Mantas
Mantas

Reputation: 232

I had different issue why IOS simulator was not appearing in fresh installation - dart sdk was not configured. I've clicked run->run there it was showing that dart is not configured, I've added flutter/bin/cache/dart-sdk in config and after that iphone simulator has appeared. Of course I followed other steps: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch

Upvotes: 0

Noor Hossain
Noor Hossain

Reputation: 1831

I have to use three steps:

running this two commands :

1) sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

2) flutter clean

3)

I have to select on Android studio Ide - (on the simulator select button drop down left hand side of main.dart showing) I have to select "Open IOS emulator".

Then the simulator run. And the simulator was Auto select on the emulator selected section.

I have used Android Studio Bumble Bee and Xcode 13.

The summary is, I think, I have to open the simulator first, then its come to online with Android studio.

enter image description here

Upvotes: 3

Abdullah Khudher
Abdullah Khudher

Reputation: 309

I fixed this problem by flowing these steps and refreshing the list of simulators

enter image description here

Upvotes: 5

test test
test test

Reputation: 1

I Fixed this issue like this:

  1. Open simulator
  2. Go to "Device" in menu
  3. Click "Erase all content and settings"

which this will delete all content and settings of the simulator but the problem of hide in the android studio devices will be fix.

Upvotes: 0

Ashwin Balani
Ashwin Balani

Reputation: 771

Also make sure that you have agreed to Xcode licenses via running the command,

sudo xcodebuild -license

Upvotes: 2

MUHAMMED IQBAL PA
MUHAMMED IQBAL PA

Reputation: 3604

Please check whether you installed the latest version of Xcode.

After the installation, try to run the following command.

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Upvotes: 252

Jimmy
Jimmy

Reputation: 1072

I ran into the same problem but unfortunately, @MUHAMMED IQBAL PA's solution didn't suffice. Running these two commands, however, resolved the problem:

  1. As pointed out by others:

    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    
  2. :

    sudo xcodebuild -runFirstLaunch
    

Upvotes: 34

Diego Ramírez
Diego Ramírez

Reputation: 470

As other people have suggested, it happens when you update XCode. So, run the command in terminal suggested by Muhammed

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Then, you probably have to run flutter clean. For it to run properly.

Upvotes: 37

Shashoug
Shashoug

Reputation: 140

it happened to me when i have updated my Xcode, use this command to let Flutter recognize your Xcode again. sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Upvotes: 2

Samet ÖZTOPRAK
Samet ÖZTOPRAK

Reputation: 3356

I came across this problem on my MacBook.

iOS toolchain - develop for iOS devices (Xcode 8.2.1) ✗ Flutter requires a minimum Xcode version of 9.0.0. Download the latest version or update via the Mac App Store.

Xcode was not updated. That is why IOS simulators are not supported.

Upvotes: 1

Related Questions