Skip to main content

How to run Android emulator with Flutter in VS Code

Step 1: Install Android Studio

After installation is complete, check the last lines of the log. If the hypervisor driver fails to install, you may see something like:

Android SDK is up to date.
Running Android Emulator hypervisor driver installer
[SC] ControlService FAILED 1062:

The service has not been started.

In this case, refer to the fix here.

Step 2: Create a Virtual Device

  1. Create an empty application in Android Studio
  2. Open Device Manager and click the + button to create a new virtual device.

img

  1. Select a device and install the desired Android version, then click Finish. Once the device is created, it will appear in Device Manager. Click the play button to launch the emulator.
note

If you see the following error, check out my blog!

img

Step 3: Run the Emulator in VSCode

  1. Leave the emulator running in Android Studio.
  2. Open your Flutter project in VSCode and click the device selector at the bottom right.

alt

  1. Open your Flutter project in VSCode and click the device selector at the bottom right. alt text

Troubleshooting

Issue with Running Emulator in VSCode

Run the following command in the terminal:

flutter doctor

If there are issues with the Android toolchain, you might see an error message like this:

alt text

Fixing Missing cmdline-tools

  • Open Android Studio > Tools > SDK Manager > SDK Tools, then check Android SDK Command-line Tools (latest) alt text

Fixing Android License Status Unknow

  • In the terminal, run the following command to show all Android licenses:
flutter doctor --android-licenses

Accept all terms and conditions when prompted.

Issue with Running a Virtual Device in Android Studio

  • If you see the message "The emulator process for AVD xxx has terminated" while trying to run a virtual device, check out my blog for troubleshooting tips on how I debug and fix this issue!