Android Studio 使用Flutter在VSCode中未检测到仿真器

6mw9ycah  于 2022-11-16  发布在  Android
关注(0)|答案(6)|浏览(494)

我正在尝试使用仿真器,当我启动它时,它开始加载,但在VSCode中没有连接。我如何连接以便VSCode检测到它?

当我启动adb-server时,得到以下输出

adb server version (40) doesn't match this client (39); killing...
ADB server didn't ACK
Full server startup log: /tmp/adb.1000.log
Server had pid: 31775
--- adb starting (pid 31775) ---
adb I 11-22 22:58:24 31775 31775 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 11-22 22:58:24 31775 31775 main.cpp:57] Version 1:8.1.0+r23-5~18.04
adb I 11-22 22:58:24 31775 31775 main.cpp:57] Installed as /usr/lib/android-sdk/platform-tools/adb
adb I 11-22 22:58:24 31775 31775 main.cpp:57] 
adb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:416] adb_auth_init...
adb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:174] read_key_file '/home/sahil/.android/adbkey'...
adb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:391] adb_auth_inotify_init...
adb server killed by remote request

* failed to start daemon
error: cannot connect to daemon

flutter doctor日志:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Linux, locale en_GB.UTF-8)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.35.1)
[!] Connected device

! Doctor found issues in 3 categories.

flutter devices日志:

No devices detected.

Run 'flutter emulators' to list and start any available device emulators.

Or, if you expected your device to be detected, please run "flutter doctor" to
diagnose potential issues, or visit https://flutter.dev/setup/ for troubleshooting
tips.

• Device emulator-5554 is offline.
kqlmhetl

kqlmhetl1#

该设备没有权限。请运行flutter doctorflutter devices,如果似乎没有连接任何设备(在本例中为模拟设备),则需要对adb-server执行kill操作,打开模拟程序,然后启动adb-server
如果之后问题仍然存在,请尝试flutter doctor --android licenses
如果它仍然继续,请张贴您的flutter doctorflutter devices输出。
此致

kokeuurv

kokeuurv2#

大多数情况下,IDEEmulator重启就足够了,但在某些情况下重启机器是最好的,其中可以尝试重启adb服务器。

adb kill-server
adb start-server

**可选:**此外,如果您希望在没有电缆的情况下使用设备,您可以设置设备的root,然后通过无线方式使用adb(如果您的设备没有此功能。现代设备内置了此选项。)

k2arahey

k2arahey3#

1.禁用和启用抖动插件
1.禁用和启用Dart插件
1.已重新启动Vscode
1.已重新启动PC
逐一尝试这四个选项,希望问题能得到解决。

hmtdttj4

hmtdttj44#

在我的例子中,因为我把android SDK移到了不同的路径,而不是默认的c:,所以vs代码不会检测到模拟器。
解决
1.转到Android SDK文件夹
1.找到名为“platform-tools”的文件夹
1.复制路径,并将其添加到环境变量中
1.重新启动vs代码

nbnkbykc

nbnkbykc5#

在我的例子中,VSCode没有检测到任何设备,但是flutter doctor检测到了。
sudo kill -9 $(pgrep Electron)以终止VSCode的所有示例,然后重新启动VSCode。

bd1hkmkf

bd1hkmkf6#

对于我的例子,每当VS代码没有检测到模拟器时,我就使用**冷 Boot **来启动模拟器。我希望这能帮助一些人。

相关问题