Flutter学习笔记

一 Flutter的下载和安装(Mac)

2019-07-26  本文已影响0人  王俏

1.到网站下载flutte SDK:

2.将下载的文件夹放到 应用程序 目录下

3.终端下配置系统环境变量和镜像

4.在终端配置

#Flutter 镜像配置
$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
source ~/.bash_profile

#Flutter 环境变量配置
$ export FLUTTER=/Applications/flutter/bin
$ export PATH=$FLUTTER:$PATH

配置完成后,重新打开终端或者输入命令载入配置

source ~/.bash_profile

5. 终端输入命令查看

flutter doctor

6.vs code 安装Flutter 扩展

7.安装Android Studio

flutter doctor --android-licenses
Running Gradle task 'assembleDebug'...

文件路径:项目 --> Android -->build.gradle 文件
修改内容:找到buildscript 和allprojects 将里面的:

buildscript {

    repositories {

 maven { url "[https://maven.aliyun.com/repository/google](https://maven.aliyun.com/repository/google)" }

 maven { url "[https://maven.aliyun.com/repository/jcenter](https://maven.aliyun.com/repository/jcenter)" }

 maven { url "[http://maven.aliyun.com/nexus/content/groups/public](http://maven.aliyun.com/nexus/content/groups/public)"}

        // google()

        // jcenter()

        }

    dependencies {

 classpath 'com.android.tools.build:gradle:3.2.0'

    }

}

文件路径:flutter/packages/flutter_tools/gradle/flutter.gradle
修改内容(加入阿里镜像):

buildscript {
    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.2.0'
    }
}

8.安装JDK下载地址

上一篇下一篇

猜你喜欢

热点阅读