文章目录

  • ​​环境搭建系列文章目录​​
  • ​​一、安装系统最低要求​​
  • ​​二、安装步骤​​
  • ​​1.获取 Flutter SDK​​
  • ​​2.下载 Android Studio​​
  • ​​3.环境变量配置加速地址​​
  • ​​4.检测安装配置​​
  • ​​4.1 issues​​
  • ​​SDK问题​​
  • ​​产生原因​​
  • ​​解决​​
  • ​​国内`google`服务访问受限制问题​​
  • ​​已有项目修改​​
  • ​​新建项目修改​​
  • ​​留意SDK路径​​
  • ​​arcgis 引入​​
  • ​​5.Android Studio 安装​​
  • ​​三、创建Flutter项目​​
  • ​​四、运行,最终效果​​

一、安装系统最低要求

  • 操作系统: Windows 7 或更高版本 (64-bit)
  • 磁盘空间: 400 MB (不包括Android Studio的磁盘空间)
  • ​Git for Windows​​ (Git命令行工具)

二、安装步骤

1.获取 Flutter SDK

2.下载 Android Studio

3.环境变量配置加速地址

PUB_HOSTED_URL  https://pub.flutter-io.cn

FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn

Path 新增 flutter安装目录/bin

Flutter windows开发环境搭建_flutter


Flutter windows开发环境搭建_maven_02

4.检测安装配置

flutter doctor

4.1 issues

SDK问题
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
instructions.
Android sdkmanager tool not found (C:\Users\petelu\AppData\Local\Android\sdk\tools\bin\sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.
产生原因

我们自己定了了​​Android SDK​​ Flutter 找不到

解决

系统环境变量中增加Android的配置

ANDROID_HOME `D:\file\android\Sdk`

%ANDROID_HOME%\tools

%ANDROID_HOME%\platform-tools

Flutter windows开发环境搭建_maven_03


Flutter windows开发环境搭建_maven_04

国内google服务访问受限制问题
已有项目修改

修改项目中​​android/build.gradle​​文件,仓库地址改为阿里云

aven { url 'https://maven.aliyun.com/repository/google' }

maven { url 'https://maven.aliyun.com/repository/jcenter' }

maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }


private static final String MAVEN_REPO = "https://storage.flutter-io.cn/download.flutter.io";
新建项目修改
# 修改Flutter的配置文件, 该文件在Flutter安装目录

/packages/flutter_tools/gradle/flutter.gradle

Flutter windows开发环境搭建_flutter_05

留意SDK路径

Flutter windows开发环境搭建_Android_06

arcgis 引入
rootProject.allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
// maven { url 'https://esri.bintray.com/arcgis' }
maven { url 'https://esri.jfrog.io/artifactory/arcgis' }
}
}
5.Android Studio 安装
  1. 设置Flutter、Dart SDK 路径

Flutter windows开发环境搭建_Android_07

  1. 安装Flutter & Dart插件

Flutter windows开发环境搭建_flutter_08

  1. 设置Android SDK开启模拟器或者连接真机

三、创建Flutter项目

Flutter windows开发环境搭建_maven_09

四、运行,最终效果
# 查看详细的Flutter 启动构建打包过程
flutter run --verbose

Flutter windows开发环境搭建_Android_10


Flutter windows开发环境搭建_Android_11