1、安装和配置好Android Studio 3.2
(Android Studio 的安装路径为:D:\Android\Android Studio;Android SDK路径为:D:\Android\sdk)
2、在Android Studio 中搜索并添加 Plugins:flutter
3、去flutter官网下载其最新可用的安装包,点击下载(https://flutter.io/sdk-archive/#windows) ;
4、解压 flutter_windows_v1.0.0-stable.zip 到D:\android(解压后路径为:D:\android\flutter);
5、添加用户环境变量,添加以下三个用户变量
ANDROID_HOME =D:\Android\sdk
PUB_HOSTED_URL=https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
用户环境变量Path添加一个值 :Path=D:\android\flutter
在“用户变量”下检查是否有名为“Path”的条目:
如果该条目存在, 追加 flutter\bin的全路径,使用 ; 作为分隔符.
如果条目不存在, 创建一个新用户变量 Path ,然后将 flutter\bin的全路径作为它的值.
在“用户变量”下检查是否有名为”PUB_HOSTED_URL”和”FLUTTER_STORAGE_BASE_URL”的条目,如果没有,也添加它们。
重启Windows以应用此更改
6、在D:\android\flutter文件夹下运行 flutter_console.bat,在出来的Flutter 控制台窗口中输入命令来验证你是否已经正确地设置了:
flutter doctor
D:\Android\flutter>flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel beta, v0.11.10, on Microsoft Windows [Version 10.0.17763.134], locale zh-CN) [!] Android toolchain - develop for Android devices (Android SDK 28.0.3) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [√] Android Studio (version 3.2) [!] Connected device ! No devices available ! Doctor found issues in 2 categories.
根据提示使用命令进行授权:flutter doctor –android-licenses
(各项回答Y)
再次验证设置:
D:\Android\flutter>flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel beta, v0.11.10, on Microsoft Windows [Version 10.0.17763.134], locale zh-CN) [√] Android toolchain - develop for Android devices (Android SDK 28.0.3) [√] Android Studio (version 3.2) [!] Connected device ! No devices available ! Doctor found issues in 1 category.