VScode如果想要在android模擬器上調試的話,需要先打開一個android的模擬器。我們可以從android studio中打開,然后再打開VScode即可。
如果打開了模擬器之后,VScode右下角還是顯示no device的話,我們可以先命令行運行 flutter doctor檢測一下問題所在,如果是SDK的問題,會顯示
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
這是因為找不到SDK所致,如果已經下載了SDK 那么只需要添加一個環境變量即可
再次輸入 flutter doctor檢測 如果發現證書問題的話
則需要在終端下輸入 flutter doctor --android-licenses即可