Bootstrap

flutter的环境安装配置问题

(1)安装android SDK时,会出现Android license 的问题,将JAVA JDK降级到SE8就可以了,很多版本没对应上,JAVA8是比较稳定的,包括后面的gradle也需要基于JAVA8

问题描述:[!] Android toolchain - develop for Android devices (Android SDK 27.0.3) ✗ Android license status unknown.

解决:安装JAVA8后,运行 flutter doctor --android-licenses

(2) 卡在Running ‘gradle assembleDebug运行阶段,引用国内阿里云的镜像解决。

问题描述:Running Gradle task 'assembleDebug'...

解决:

  修改项目中`android/build.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.1'
    }
}

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
}

 修改Flutter的配置文件, 该文件在`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.1'
    }
}

 

;