Configuring Android Devices for Flutter

Codecademy Team
This article describes how to set up different emulated and physical devices in Android Studio.

Introduction

Before we can run our Flutter app on different devices, we must do some more configuration. We can connect to real or simulated devices. Let’s set them up!

Device Manager

We can open Device Manager by using the Tools menu. There is an option for Device Manager.

Tools Menu in Android Studio

Device Manager in Dropdown Menu

Device Manager opens in an area on the right side of the Android Studio window.

Device Manager in Android Studio

Creating a Virtual Device

Android Studio supports setting up different Android virtual devices. These devices simulate actual Android hardware so no physical device is necessary. Let’s start by selecting the Create Device button in the Device Manager.

Selecting Hardware

The first part of creating a virtual device is selecting the hardware we want to simulate. There are many screen sizes and device types we can select.

Selection of Android Hardware to Emulate

We can select one of the Google Pixel phones which are common devices especially used in Android Development. These devices always receive the most up-to-date Android Operating System updates.

Selecting API Level

Next, we will need to select the API level. The API level is the version of Android we want to simulate. We need to download the specific version and then hit the Next button. New Android devices often ship with the latest Android version.

Selection of Android API Level to Emulate

Naming the Device

Next, we give our Virtual device a name. This name will show up now in the list of devices where we can run our Flutter App!

Naming the Android Emulator

Connecting to a Physical Device

We can also run our Flutter apps on a physical device!

Enable developer mode

To enable developer mode on our Android device we need to:

  • Open the device settings
  • Go to about phone
  • Tap the build number until prompted to turn on developer mode

Once developer mode is enabled we can find a new area under device settings called Developer options.

Enable Wireless Debugging

Now we need to enable wireless debugging:

  • Open up the Developer options menu under settings.
  • Go to the Wireless debugging option and enable it.
  • Tap the Wireless debugging menu option.
  • On the next screen select Pair device with QR code.

QR Code in Android Studio

Now that our device is ready, we will show the QR code in Android Studio.

In the Device Manager, we select the Physical tab. The Pair using Wi-Fi button opens a QR code popup we can scan with our Android device.

Pair Android Device over WiFi

Review

Congratulations! We are almost done with this lesson, but before we finish, let’s review what we learned about configuring Android devices:

  • We can run a Flutter app on Virtual and Physical devices.
  • Before running on a device we need to configure the device.
  • Devices can be configured by using the Device Manager in Android Studio.
  • When creating a virtual device we need to select the hardware and API version to emulate.
  • We can connect to physical devices over WiFi in Android Studio.