Platform setup

iOS setup

To develop Flutter apps for iOS, you need a Mac with Xcode installed.

  1. Install the latest stable version of Xcode (using web download or the Mac App Store).

  2. Configure the Xcode command-line tools to use the newly-installed version of Xcode by running the following from the command line:

    content_copy

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

    This is the correct path for most cases, when you want to use the latest version of Xcode. If you need to use a different version, specify that path instead.

  3. Make sure the Xcode license agreement is signed by either opening Xcode once and confirming or running sudo xcodebuild -license from the command line.

Versions older than the latest stable version may still work, but are not recommended for Flutter development. Using old versions of Xcode to target bitcode is not supported, and is likely not to work.

With Xcode, you’ll be able to run Flutter apps on an iOS device or on the simulator.

Set up the iOS simulator

To prepare to run and test your Flutter app on the iOS simulator, follow these steps:

  1. On your Mac, find the Simulator via Spotlight or by using the following command:

    content_copy

    $ open -a Simulator
  2. Make sure your simulator is using a 64-bit device (iPhone 5s or later). You can check the device by viewing the settings in the simulator’s Hardware > Device or File > Open Simulator menus.

  3. Depending on your development machine’s screen size, simulated high-screen-density iOS devices might overflow your screen. Grab the corner of the simulator and drag it to change the scale. You can also use the Window > Physical Size or Window > Pixel Accurate options if your computer’s resolution is high enough.

    • If you are using a version of Xcode older than 9.1, you should instead set the device scale in the Window > Scale menu.

Android setup

Note: Flutter relies on a full installation of Android Studio to supply its Android platform dependencies. However, you can write your Flutter apps in a number of editors; a later step discusses that.

Install Android Studio

  1. Download and install Android Studio.

  2. Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.

  3. Run flutter doctor to confirm that Flutter has located your installation of Android Studio. If Flutter cannot locate it, run flutter config --android-studio-dir <directory> to set the directory that Android Studio is installed to.

Set up your Android device

To prepare to run and test your Flutter app on an Android device, you need an Android device running Android 4.1 (API level 16) or higher.

  1. Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.

  2. Windows-only: Install the Google USB Driver.

  3. Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.

  4. In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device. By default, Flutter uses the version of the Android SDK where your adb tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_SDK_ROOT environment variable to that installation directory.

Set up the Android emulator

To prepare to run and test your Flutter app on the Android emulator, follow these steps:

  1. Enable VM acceleration on your machine.

  2. Launch Android Studio, click the AVD Manager icon, and select Create Virtual Device…

    • In older versions of Android Studio, you should instead launch Android Studio > Tools > Android > AVD Manager and select Create Virtual Device…. (The Android submenu is only present when inside an Android project.)

    • If you do not have a project open, you can choose Configure > AVD Manager and select Create Virtual Device…

  3. Choose a device definition and select Next.

  4. Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.

  5. Under Emulated Performance, select Hardware - GLES 2.0 to enable hardware acceleration.

  6. Verify the AVD configuration is correct, and select Finish.

    For details on the above steps, see Managing AVDs.

  7. In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.

Agree to Android Licenses

Before you can use Flutter, you must agree to the licenses of the Android SDK platform. This step should be done after you have installed the tools listed above.

  1. Make sure that you have a version of Java 8 installed and that your JAVA_HOME environment variable is set to the JDK’s folder.

    Android Studio versions 2.2 and higher come with a JDK, so this should already be done.

  2. Open an elevated console window and run the following command to begin signing licenses.content_copy

    $ flutter doctor --android-licenses
  3. Review the terms of each license carefully before agreeing to them.

  4. Once you are done agreeing with licenses, run flutter doctor again to confirm that you are ready to use Flutter.

Last updated