How do I connect an Android phone to Visual Studio Code?

5,173

Here is one of the workaround:

Open Android Studio then click on SDK Manager (down-pointing arrow)

This should open a new box with your Android SDK Location at the top. It should look like this:

/Users/username/Library/Android/sdk

Configure the path of android-sdk

flutter config --android-sdk /Users/username/Library/Android/sdk

Add android-license to Flutter

flutter doctor --android-licenses

Then, you can run flutter doctor to verify,

Share:
5,173
Logan Blackisle
Author by

Logan Blackisle

Updated on December 24, 2022

Comments

  • Logan Blackisle
    Logan Blackisle over 1 year

    VSCode shows 'No Device' in the status bar, while Android Studio has no problems connecting to device over usb, or creating a virtual device.

    When I run flutter doctor in VSCode terminal, I get:

    flutter doctor message

    When I click the 'No Device' (as a shortcut to Flutter: Launch Emulator), I get the error message

    avdmanager is missing from the Android SDK

    I've tried:

    • updating my PATH variables - I was a bit confused as to which folder I should point to, so I tried every single one I found mention of:
    1. C:\Users\USERNAME\AppData\Local\Android\Sdk;
    2. C:\Flutter\flutter\bin;
    3. C:\Flutter\flutter\bin\cache\dart-sdk\bin;
    • updating "dart.flutterSdkPath" in VSCode
    • specifying ADB location --> C:/Users/USERNAME/AppData/Local/Android/Sdk/platform-tools/adb.exe
    • uninstalling and reinstalling Android Studio
    • deleting, downloading, and re-unzipping Android/Sdk/platform-tools

    And nothing makes any change.

    • CoderUni
      CoderUni over 3 years
      "avdmanager is missing from the Android SDK" your problem is with android sdk. try uninstalling and resinstlling it. You should also download the avd in android studio
    • secret
      secret over 3 years
      May you try Genymotion?
    • Vinamra Jaiswal
      Vinamra Jaiswal over 3 years
      recheck if usb debugging has been enabled or not?
    • Logan Blackisle
      Logan Blackisle over 3 years
      @VinamraJaiswal USB debugging has been enabled - no change (VSCode refuses to see any devices regardless if that device is an actual connected device, or an emulated one through Android Studio).
    • Logan Blackisle
      Logan Blackisle over 3 years
      @Uni I already tried deleting, downloading, and re-unzipping Android/Sdk/platform-tools, shouldn't that take care of it if that was the problem?
    • GrahamD
      GrahamD over 3 years
      Maybe this answer can help? stackoverflow.com/questions/49115840/…
  • Muhammad Qasim
    Muhammad Qasim over 2 years
    I've done all this and Flutter cli can detect android devices/emulators but not the VS Code extension :( It just keep giving error avdmanager is missing from the Android SDK