I try to make android studio (emulator) work with vs-code but have an error "avdmanager is missing from the Android SDK"

Viewed 20659

This is my PATH

export ANDROID_SDK_ROOT=/mnt/sda1/DevTools/sdk/
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=${PATH}:/mnt/sda1/DevTools/sdk/platform-tools

enter image description here

I try many cases, but still this error!

5 Answers

Try :

flutter doctor --android-licenses

if something wrong, try to locate android sdk path.

flutter config --android-sdk {path}

Mine :

flutter config --android-sdk C:\Android\Sdk

This worked for me. If you have sdkmanager, avdmanager and emulator, and you have them in your PATH environmental variable, then

  1. Download a system image:

sdkmanager "system-images;android-30;google_apis_playstore;x86_64"

(you can find available packages with sdkmanager --list --verbose)

  1. Create a new virtual device with

avdmanager create avd --name MyAndroidDevice --package "system-images;android-30;google_apis_playstore;x86_64"

  1. Start the emulator

emulator -avd MyAndroidDevice

  1. Now restart VSCode and open your Flutter project. The new device should be at the bottom right corner or you should be able to choose it by clicking on "No device".

I know this is an old question but setting my $PATH variable in ~/.bashrc (I'm on Ubuntu 20.04) did not work for me.

I needed to setup Android Emulator for VScode, because I wanted to run my flutter app, which seems to be the same issue as OP had.

Instead of setting the $PATH directly you can actually use Flutter in the terminal to do it.

If you run "flutter config" in the terminal you get something like:


Configure Flutter settings.

To remove a setting, configure it to an empty string.

The Flutter tool anonymously reports feature usage statistics and basic crash reports to help improve Flutter tools over time. See Google's privacy policy: https://www.google.com/intl/en/policies/privacy/

....

Run "flutter help" to see global options.

Settings: android-sdk: <my_path_to_android_tools>

Analytics reporting is currently enabled.


You can then see the $PATH that is currently set with flutter under:

Settings: android-sdk: <my_path_to_android_tools>

Mine was incorrect so I changed it to the current one with the command:

flutter config --android-sdk <my_path_to_android_tools>

Afterwards I restarted VScode and when it was finished loading I could now press the "device" button in the right hand corner and then select emulator that I had already created. I used one of the above answers to install the emulator itself.

It took a while to launch the emulator the first time due to installing some dependencies but it did work!

I tried this and works:

  • from terminal run flutter config --enable-android. You will get Setting "enable-android" value to "true".
  • after that open android studio, set up virtual devices first if you haven't. Open Android Studio -> Configure -> AVD Manager -> Create Your Virtual Device
  • Go back to your VS Code, open command Palette (Ctrl+P or cmd+P, then type >), or from View -> Command palette... -> Flutter: Select Device -> choose your android device

I faced the same issue and solved it running flutter doctor from the terminal, in VS Code. In my case, I had the android sdk located in a custom location (D drive), the reason why it wasn't found automatically. The "doctor" told me to run flutter config --android-sdk <my-sdk-custom-location>. Running it and restarting the IDE made the trick. Hopefully this helps someone facing the same problem.

Related