文档地址:

1. 下载Flutter

AS terminal 输入

git clone -b alpha https://github.com/flutter/flutter.git

2. 配置环境变量

这里我下载好的Flutter是在项目目录下的,搬出来放到单独目录下后,配置好Path。路径指向Flutter的bin目录。

3. cmd 输入指令 flutter doctor

这里失败了重新输入一次即可。在下载过程中报了个错。

frc 2fa186d6991389cb5f947bbf57bb9461 - Android Flutter(三)Flutter安装
image.png
 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.dev/setup/#android-setup for detailed instructions).
      If the 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.

这么一段错,提示我配置环境变量,那就配一个呗。Setting里面查了下自己默认的Android SDK路径,然后再环境变量中配置,名称为ANDROID_HOME,然后配置到Path里。
再次输入flutter doctor,如果你这时候还不成功…额。
你是不是没重启下cmd来着?

frc 0931fff5004a7f989dbd1e7ae85d56e4 - Android Flutter(三)Flutter安装

好像暴露了点啥。好的我们继续。
这次不报错了,报了个感叹号,看一下

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

按提示走一下呢?
输入

flutter doctor –android-licenses

然后一路y就行了。

这次doctor显示无异常了。

4. 安装插件

这个Plugin里搜一下Dart和Flutter就可以安装了,Android开发选手的基本操作。重启AS。

frc 3d5185469d174e2c543ab5a01fc7fb75 - Android Flutter(三)Flutter安装

OK,Flutter安装搞定了。

Android Flutter(三)Flutter安装