欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Flutter环境搭建(适合Android开发者)

程序员文章站 2022-03-30 18:44:57
1.下载sdk,地址如下 https://flutter.dev/docs/development/tools/sdk/releases下载后,放在任意盘符下,例如E盘,直接解压,得到flutter文件夹2.配置环境变量 ,path下增加3.配置镜像镜像可选地址参考:https://flutter.cn/community/china以清华的镜像为例4.修改 E:\flutter\packages\flutter_tools\gradle\flutter.gr.....

1.下载sdk,地址如下

   https://flutter.dev/docs/development/tools/sdk/releases

下载后,放在任意盘符下,例如E盘,直接解压,得到flutter文件夹

Flutter环境搭建(适合Android开发者)

2.配置环境变量 ,path下增加

Flutter环境搭建(适合Android开发者)

3.配置镜像

镜像可选地址参考:https://flutter.cn/community/china

以清华的镜像为例

Flutter环境搭建(适合Android开发者)

Flutter环境搭建(适合Android开发者)

4.修改 E:\flutter\packages\flutter_tools\gradle\flutter.gradle 文件,如下

Flutter环境搭建(适合Android开发者)

        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 DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn/download.flutter.io";

5.修改 E:\flutter\packages\flutter_tools\gradle\resolve_dependencies.gradle 文件,如下

Flutter环境搭建(适合Android开发者)

url "http://download.flutter.io"

6.修改项目 android根目录下的build.gradle 文件,如下

Flutter环境搭建(适合Android开发者)

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'}

7.如果遇到gradle下载不下来的情况,自己手动下载

Flutter环境搭建(适合Android开发者)

下载地址:https://services.gradle.org/distributions/

下载完之后,为zip,不需要解压,直接放在C:\Users\Yang\.gradle\wrapper\dists\gradle-5.6.2-all\9st6wgf78h16so49nn74lgtbb

文件夹下,(路径名可能有所变化,套路一样)Flutter环境搭建(适合Android开发者)

8、重启项目,哦了

参考文章

https://www.jianshu.com/p/171a9660e1f9

https://blog.csdn.net/qq_23215957/article/details/107906257

 

本文地址:https://blog.csdn.net/baidu_33575737/article/details/108162955