flutter安装

1、系统要求android

  • Windows7 SP1或更高版本
  • 工具:
  1. Windows PowerShell 5.0 
  2. Git for Windows 2.x

 

       配置环境变量git

       

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

 

2、获取Flutter SDKgithub

      运行Git Bashshell

cd /d/software/
git clone -b stable https://github.com/flutter/flutter.git

    当前最新稳定版:v1.7.8+hotfix.4windows

 

3、下载 android sdk工具

      http://www.androiddevtools.cn/网站

      在这个网站上下载 SDK Toolsui

      下载后解压到 D:\software\android-sdk-windows文件夹this

      运行 SDK Manager.exe 在弹出窗口中 以下选择spa

      Tools 下选择前三个

      Api选择最新

      Extras 下全选

 

     配置环境变量

     

ANDROID_HOME=D:\software\android-sdk-windows

把 ;%ANDROID_SDK_HOME%\platform-tools;;%ANDROID_SDK_HOME%\tools 追加到系统环境变量Path中

 

4、flutter doctor

在 flutter 目录下双击 flutter_console.bat 进入命令行,运行 flutter doctor 命令检查 运行环境信息,若是没安装Dart则自动安装

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[!] Android Studio (version 3.4)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Community Edition (version 2019.2)
    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.
[√] IntelliJ IDEA Ultimate Edition (version 2019.2)
[√] VS Code (version 1.37.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 4 categories.

感叹号的暂时无论,若是出现 X 则根据提示操做

 

 

5、安装过程当中碰到的问题

    1.Android license status unknown.

      首先 运行 flutter doctor --android-licenses,若是提示

A newer version of the Android SDK is required. To update, run:
D:\software\android-sdk-windows\tools\bin\sdkmanager --update

     则运行 D:\software\android-sdk-windows\tools\bin\sdkmanager --update ,若是提示

Warning: An error occurred during installation: Failed to move away or delete existing target file: D:\software\android-sdk-windows\tools
Move it away manually and try again..
done

    解决方法:进入 D:\software\android-sdk-windows 目录,把tools文件夹改成tool,再运行 D:\software\android-sdk-windows\tool\bin\sdkmanager --update

   运行完成后会从新建立tools文件夹,把tools文件夹下的全部文件复制到tool文件夹后把文件夹名称改成tools.

   再运行  flutter doctor --android-licenses

 

 

参考:https://flutter.dev/docs/get-started/install/windows

相关文章
相关标签/搜索