使用 Flutter 在 VSCode 中未检测到模拟器

Sah*_*are 5 android dart android-studio visual-studio-code flutter

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

\n\n

\n\n

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

\n\n
adb server version (40) doesn\'t match this client (39); killing...\nADB server didn\'t ACK\nFull server startup log: /tmp/adb.1000.log\nServer had pid: 31775\n--- adb starting (pid 31775) ---\nadb I 11-22 22:58:24 31775 31775 main.cpp:57] Android Debug Bridge version 1.0.39\nadb I 11-22 22:58:24 31775 31775 main.cpp:57] Version 1:8.1.0+r23-5~18.04\nadb I 11-22 22:58:24 31775 31775 main.cpp:57] Installed as /usr/lib/android-sdk/platform-tools/adb\nadb I 11-22 22:58:24 31775 31775 main.cpp:57] \nadb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:416] adb_auth_init...\nadb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:174] read_key_file \'/home/sahil/.android/adbkey\'...\nadb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:391] adb_auth_inotify_init...\nadb server killed by remote request\n\n* failed to start daemon\nerror: cannot connect to daemon\n
Run Code Online (Sandbox Code Playgroud)\n\n

flutter doctor日志:

\n\n
Doctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel stable, v1.9.1+hotfix.4, on Linux, locale en_GB.UTF-8)\n\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 28.0.3)\n[!] Android Studio (version 3.2)\n    \xe2\x9c\x97 Flutter plugin not installed; this adds Flutter specific functionality.\n    \xe2\x9c\x97 Dart plugin not installed; this adds Dart specific functionality.\n[!] IntelliJ IDEA Ultimate Edition (version 2019.2)\n    \xe2\x9c\x97 Flutter plugin not installed; this adds Flutter specific functionality.\n    \xe2\x9c\x97 Dart plugin not installed; this adds Dart specific functionality.\n[\xe2\x9c\x93] VS Code (version 1.35.1)\n[!] Connected device\n\n! Doctor found issues in 3 categories.\n
Run Code Online (Sandbox Code Playgroud)\n\n

flutter devices日志:

\n\n
No devices detected.\n\nRun \'flutter emulators\' to list and start any available device emulators.\n\nOr, if you expected your device to be detected, please run "flutter doctor" to\ndiagnose potential issues, or visit https://flutter.dev/setup/ for troubleshooting\ntips.\n\n\xe2\x80\xa2 Device emulator-5554 is offline.\n
Run Code Online (Sandbox Code Playgroud)\n

小智 3

设备没有权限。运行flutter doctorflutter devices,如果似乎没有设备连接(在本例中为模拟),您需要kill打开adb-server模拟器,然后启动adb-server

如果此后问题仍然存在,请尝试flutter doctor --android licenses

如果仍然继续,请发布您的flutter doctor&flutter devices输出。

问候