Flutter 开发环境配置

用户头像
玉龙BB
关注
发布于: 2020 年 06 月 01 日
Flutter开发环境配置

在Window10操作系统上安装和配置Flutter的开发环境。

Flutter SDK

国内镜像下载地址:https://mirrors.tuna.tsinghua.edu.cn/flutter/flutter_infra/releases/stable/windows/?C=M&O=D

配置环境变量

将下载后的Flutter SDK解压到D盘src文件夹。



FLUTTER_HOME=D:\src\flutter
PATH=%FLUTTER_HOME%\bin



环境变量配置成功验证



flutter doctor

配置镜像

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



Andorod SDK

Android SDK 的安装通过安装Android Studio自动安装。

下载地址:https://developer.android.google.cn/studio/

配置环境变量

将Android SDK下载到D盘sdk文件夹

ANDROID_HOME=D:\sdk
PATH=%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools



配置证书

flutter doctor --android-licenses



VSCode安装Flutter和Dart插件

下载地址:https://code.visualstudio.com/Download



创建Flutter项目运行

配置镜像

android\build.gradle

buildscript {
ext.kotlin_version = '1.3.50'
repositories {
// google()
// jcenter()
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' }
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
// google()
// jcenter()
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' }
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}


D:\src\flutter\packages\flutter_tools\gradle\flutter.gradle

buildscript {
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' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

private static final String MAVEN_REPO="https://storage.flutter-io.cn/download.flutter.io";




参考链接

【futter中文网】https://flutterchina.club/



用户头像

玉龙BB

关注

Angular爱好者,前端开发 2018.11.13 加入

Angular + Spring Boot + MongoDB / MySQL, 学习研究的方向是大数据下的「 知识图谱 」 和 「 数据可视化分析 」 Github: https://github.com/yulongbb

评论

发布
暂无评论
Flutter开发环境配置