简体   繁体   English

如何将 Android 手机连接到 Visual Studio Code?

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

VSCode shows 'No Device' in the status bar, while Android Studio has no problems connecting to device over usb, or creating a virtual device. VSCode 在状态栏中显示“无设备”,而 Android Studio 通过 USB 连接到设备或创建虚拟设备没有问题。

When I run flutter doctor in VSCode terminal, I get:当我在 VSCode 终端中运行 flutter doctor 时,我得到:

flutter doctor message扑医生留言

When I click the 'No Device' (as a shortcut to Flutter: Launch Emulator), I get the error message当我单击“无设备”(作为 Flutter: Launch Emulator 的快捷方式)时,我收到错误消息

avdmanager is missing from the Android SDK Android SDK 中缺少 avdmanager

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:更新我的 PATH 变量 - 我对应该指向哪个文件夹有点困惑,所以我尝试了我发现提到的每一个:
  1. C:\\Users\\USERNAME\\AppData\\Local\\Android\\Sdk; C:\\Users\\USERNAME\\AppData\\Local\\Android\\Sdk;
  2. C:\\Flutter\\flutter\\bin; C:\\颤振\\颤振\\bin;
  3. C:\\Flutter\\flutter\\bin\\cache\\dart-sdk\\bin; C:\\Flutter\\flutter\\bin\\cache\\dart-sdk\\bin;
  • updating "dart.flutterSdkPath" in VSCode在 VSCode 中更新“dart.flutterSdkPath”
  • specifying ADB location --> C:/Users/USERNAME/AppData/Local/Android/Sdk/platform-tools/adb.exe指定 ADB 位置 --> C:/Users/USERNAME/AppData/Local/Android/Sdk/platform-tools/adb.exe
  • uninstalling and reinstalling Android Studio卸载并重新安装 Android Studio
  • deleting, downloading, and re-unzipping Android/Sdk/platform-tools删除、下载和重新解压 Android/Sdk/platform-tools

And nothing makes any change.没有任何改变。

Here is one of the workaround:这是解决方法之一:

Open Android Studio then click on SDK Manager (down-pointing arrow)打开 Android Studio 然后点击 SDK Manager(向下箭头)

This should open a new box with your Android SDK Location at the top.这应该会打开一个新框,顶部是您的 Android SDK 位置。 It should look like this:它应该是这样的:

/Users/username/Library/Android/sdk

Configure the path of android-sdk配置android-sdk的路径

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

Add android-license to Flutter将 android-license 添加到 Flutter

flutter doctor --android-licenses

Then, you can run flutter doctor to verify,然后,你可以运行flutter doctor来验证,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xamarin中如何将Android Phone连接到Visual Studio - How to connect Android Phone to Visual Studio in Xamarin 如何通过将鼠标悬停在 android studio 中的小部件(如 Visual Studio Code)上来获取定义 - How do I get definitions by hovering over widgets in android studio like Visual Studio Code 我如何在Android Studio IDE中获取此数据库连接代码以在手机上运行 - How do i get this database connection code in my android studio IDE to run on my phone 如何设置 Unreal Engine / Visual Studio 以便能够使用 JNI 为 Android 进行编码? - How do I setup Unreal Engine / Visual Studio to be able to code with JNI for Android? 如何使约束匹配手机的高度? (Android Studio) - How do I make constraints match height of phone? (Android Studio) 如何通过 Android Studio 查看我的手机? - how do I see my phone through Android Studio? 如何在Android中将国家/地区代码与电话号码区分开? - How do I separate a country code from a phone number in Android? 如何将 Android Studio 3.6.3 连接到 Visual Studio Emulator for Android? - How to connect Android Studio 3.6.3 to Visual Studio Emulator for Android? Android:如何将Studio连接到Genymotion虚拟设备? - Android: how do I connect Studio to Genymotion Virtual Device? 如何将 Galaxy Watch 4 连接到 Android Studio? - How do I connect Galaxy Watch 4 to Android Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM