Flutter環境配置

Flutter官網 https://flutterchina.club/html

Flutter下載

image.png

image.png

image.png

image.png

配置國內鏡像

image.png

image.png

配置Flutter環境變量

image.png

運行Flutter命令

win + R 快捷鍵,輸入cmd,回車,輸入flutter doctor,回車。android

Windows PowerShell
版權全部 (C) Microsoft Corporation。保留全部權利。

PS C:\Users\boy> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.590], locale zh-CN)
[X] Android toolchain - develop for Android devices
    X 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.
      You may also want to add it to your PATH environment variable.

[!] Android Studio (not installed)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
PS C:\Users\boy> ^C
PS C:\Users\boy>
複製代碼

報錯bash

[X] If Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.
複製代碼

解決問題 配置ANDROID_HOME環境變量而且添加到pathui

image.png

image.png

運行 flutter doctorthis

Windows PowerShell
版權全部 (C) Microsoft Corporation。保留全部權利。

PS C:\Users\boy> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.590], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (not installed)
[!] Connected device
    ! No devices available
複製代碼

報錯google

[!] Android Studio (not installed)
複製代碼

解決方案:下載最新的Android Studio,自行安裝便可。 https://developer.android.google.cn/studiospa

運行 flutter doctor插件

Windows PowerShell
版權全部 (C) Microsoft Corporation。保留全部權利。

PS C:\Users\boy> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.590], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.3)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2018.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected device (1 available)
複製代碼

報錯3d

[!] Android Studio (version 3.3)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
複製代碼

解決方案 須要安裝兩個插件:調試

  • Flutter插件: 支持Flutter開發工做流 (運行、調試、熱重載等).
  • Dart插件: 提供代碼分析 (輸入代碼時進行驗證、代碼補全等).

要安裝這些:

啓動Android Studio.

  1. 打開插件首選項 (Preferences>Plugins on macOS, File>Settings>Plugins on Windows & Linux).
  2. 選擇 Browse repositories…, 選擇 Flutter 插件並點擊 install.
  3. 重啓Android Studio後插件生效.

具體安裝以下:

image.png

運行 flutter doctor

Windows PowerShell
版權全部 (C) Microsoft Corporation。保留全部權利。

PS C:\Users\boy> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.590], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[!] IntelliJ IDEA Ultimate Edition (version 2018.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected device (1 available)

! Doctor found issues in 1 category.
複製代碼

[!] IntelliJ IDEA Ultimate Edition (version 2018.2)這個是IntelliJ IDEA編譯器,咱們只要Android Studio可用就好,你們忽視就好。

建立Flutter項目

image.png

image.png

image.png

image.png

運行Flutter工程

相關文章
相關標籤/搜索