Flutter环境搭建踩坑过程
程序员文章站
2022-06-22 08:46:00
Flutter安装1、将如下环境变量加入到用户环境变量中:PUB_HOSTED_URL=https://pub.flutter-io.cnFLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn2、获取Flutter SDK去flutter官网下载其最新可用的安装包,点击下载 ;3、重启Windows以应用此更改(必须,不重启会有坑)4、重启完毕,CMD 运行 flutter doctor[-] Android toolchain -...
Flutter安装
1、将如下环境变量加入到用户环境变量中:
PUB_HOSTED_URL=https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
2、获取Flutter SDK
去flutter官网下载其最新可用的安装包,点击下载 ;
3、重启Windows以应用此更改(必须,不重启会有坑)
4、重启完毕,CMD 运行
flutter doctor
[-] Android toolchain - develop for Android devices
• Android SDK at D:\Android\sdk
✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ
• Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
根据实际检测结果做相应处理
Android Studio安装
1、下载并安装 Android Studio
2、启动Android Studio,然后执行“Android Studio安装向导”。这将安装最新的Android SDK,Android SDK平台工具和Android SDK构建工具,这是Flutter为Android开发时所必需的
3、在settings->plugins里搜索并安装flutter插件,安装flutter同时会安装dart插件(要*)
4、创建模拟器(要*)
5、在flutter安装目录下找到 pacakges/flutter_tools_/gradle,做以下修改
①修改/packages/flutter_tools/gradle/flutter.gradle文件
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' }
maven { url 'http://download.flutter.io'}
}
把
private static final String MAVEN_REPO = "https://storage.googleapis.com/download.flutter.io";
改为
private static final String MAVEN_REPO = "https://storage.flutter-io.cn/download.flutter.io";
如图:
②修改/packages/flutter_tools/gradle/resolve_dependencies.gradle文件
repositories {
//google()
//jcenter()
maven { url 'http://download.flutter.io'}
}
至此,完成Flutter环境搭建。
本文地址:https://blog.csdn.net/xiaofanguan/article/details/107209853
上一篇: iOS开发配置Universal Links及注意事项
下一篇: 第十节课:自定义控件