新建Flutter项目Android项目后,点击运行出现报错!
这是镜像站点无法访问造成的!只需要修改为国内可访问的站点即可。
第一步:修改项目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' }
maven { url 'http://download.flutter.io'}
}
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' }
}
}
第二步:修改flutter SDK中的flutter.gradle
path: 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'
}
}
网友评论