[visual-studio-code] How to set up devices for VS Code for a Flutter emulator

I'd like to use VS Code as my editor for Flutter development, but I don't know how to get the emulator going. I've installed VS Code on Ubuntu 17.10.

I followed the first half of instructions as outlined on the Flutter: Get Started page (Create new app). Then I ran into trouble in the second half:

Run the app

  1. Make sure a target device is selected in the lower, right-hand corner of VS Code
  2. Press the F5 button on the keyboard, or invoke Debug>Start Debugging
  3. Wait for the app to launch
  4. If everything works, after the app has been built, you should see your starter app on your device or simulator:

The problem is that in that bottom right-hand corner is "No Devices."

How do I connect a device? I can't seem to find instructions anywhere.

This question is related to visual-studio-code dart flutter

The answer is


set "ANDROID_SDK_ROOT" in environment variable, solve my problem.


You can connect an Android Phone via USB cable and then it will show the device in the bottom bar.(Please note ADB must be installed. Click here for more)

Or you can completely install Android Studio and setup emulator from there and run the emulator. Then VS Code will recogzine the emulator and show at the bottom bar.


First, You have to install the Android Studio and Xcode to create phone emulator.

In VSCode you can use the Android IOS Emulator plugin to set the path of emulator to run.


Genymotion settings -> Select ADB Tab -> Select

Use custom Android SDK tools -> Add Android SDK Path (Ex: C:\Users\randika\AppData\Local\Android\sdk)

Genymotion Settings View


VS Code needs to know where Android SDK is installed on your system. On Windows, set "ANDROID_SDK_ROOT" environment variable to the Android SDK root folder.

Plus: Always check the "OUTPUT" and "DEBUG CONSOLE" tabs for errors and information.


Alternatively if you enable developer mode and (ADB) is still needed you can use connect to the device.

To enable developer Mode you go to Phone Settings > About Phone > tap buildnumber 7 times

once you have it enabled and have the device connected you can start seeing the device in VSCode


To select a device you must first start both, android studio and your virtual device. Then visual studio code will display that virtual device as an option.


ctrl+shift+p

then type Flutter:launch emulator or

run this command in your VS code terminal flutter emulators then see the result if you have installed any emulator it will show you , then to run one of them use flutter emulators --launch your_emulator_id in my case flutter emulators --launch Nexus 6 API 28 but if you havent installed any emulator you can install one with flutter emulators --create [--name xyz] then run your project flutter run inside the root directory of the project


You do not need to create a virtual device using android studio. You can use your android device running on android 8.0 or higher. All you have to do is to activate developer settings, then enable USB DEBUGGING in the developer settings. Your device will show at the bottom right side of the VS Code. Without enabling the USB debugging, the device may not show.enter image description here


You do not need Android Studio to create or run a Virtual Device. Just use sdkmanager and avdmanager from the android sdk tools.

Use the sdkmanager to download a system image of Android for x86 system.
e.g. sdkmanager "system-images;android-21;default;x86_64"

Then create a new virtual device using avdmanager.
e.g. avdmanager create avd --name AndroidDevice01 --package "system-images;android-21;default;x86_64"

Then run the new virtual device using emulator. If you don't have it just install it using the sdkmanager.
e.g. emulator -avd AndroidDevice01

If you restart VSCode and load your Flutter project. The new device should show up at the bottom right of the footer.


For me, when I was running "flutter doctor" command from Ubuntu Command line - It showed me below error.

[?] Android toolchain - develop for Android devices ? Unable to locate Android SDK.

From this error, it is obvious that "flutter doctor" was not able to find the "android sdk" and the reason for that was my android sdk was downloaded in a custom location on my Ubuntu machine.

So we must need to tell "flutter doctor" about this custom android location, using below command,

flutter config --android-sdk /home/myhome/Downloads/softwares/android-sdk/

Need to replace /home/myhome/Downloads/softwares/android-sdk/ with path to your custom location/place where android sdk is available.

Once this is done, and re-run "flutter doctor" and now it has detected the android sdk location and hence I could run avd/emulator by typing "flutter run"


The following steps were done:

  1. installed genymotion
  2. configured a device and ran it
  3. in the vscode lower right corner the device shows

Recently i switched from Windows 10 home to Elementary OS, vscode didn't start from ctr+shift+p launch emulator instead of that, i just clicked bottom right corner no device---> Start emulator worked fine.


For those people using a Mac you can go to your terminal and type

$ open -a Simulator.app

and this command will open the simulator.

After that, just go to the Debug option and tap on "Start Debugging"

enter image description here

If you want to test with an Android Emulator:

What I did was to go first to Android Studio and open a virtual Device with AVD Manager. After that you'll see another devices in your Visual Studio Code

enter image description here

In the bottom right you'll see now that you have 2 devices connected. Now, you can test with any of this devices.


you can use 'Android iOS Emulator' plugin and Add the Android Studio emulator script to your settings in Visual Studio Code:

Mac: emulator.emulatorPath": "~/Library/Android/sdk/tools/emulator

Windows: emulator.emulatorPath": "<your android home>\\Sdk\\emulator\\emulator.exe

Linux: emulator.emulatorPath": "~/Documents/SDK/tools

Your visual studio code settings are found here: File -> Preferences -> Setting -> User Setting -> Extensions -> Emulator Configuration. Open command pallete Cmd-Shift-P -> Type Emulator


Examples related to visual-studio-code

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app Visual Studio Code PHP Intelephense Keep Showing Not Necessary Error Cannot edit in read-only editor VS Code How to setup virtual environment for Python in VS Code? Pylint "unresolved import" error in Visual Studio Code Why do I keep getting Delete 'cr' [prettier/prettier]? How to set up devices for VS Code for a Flutter emulator VSCode single to double quote automatic replace js 'types' can only be used in a .ts file - Visual Studio Code using @ts-check How can I clear the terminal in Visual Studio Code?

Examples related to dart

How to integrate Dart into a Rails app Flutter Countdown Timer How to make an AlertDialog in Flutter? Set the space between Elements in Row Flutter Flutter: RenderBox was not laid out Space between Column's children in Flutter How to change status bar color in Flutter? How can I add shadow to the widget in flutter? Flutter - The method was called on null Flutter- wrapping text

Examples related to flutter

Flutter Countdown Timer How to make an AlertDialog in Flutter? FlutterError: Unable to load asset Set the space between Elements in Row Flutter Flutter: RenderBox was not laid out Space between Column's children in Flutter How to change status bar color in Flutter? How can I add shadow to the widget in flutter? Flutter - The method was called on null Flutter- wrapping text