AS Message窗口显示 依赖下载失败:
1、修改仓库地址的配置:android/build.gradle
repositories {
maven { url 'https://download.flutter.io' }
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://maven.aliyun.com/repository/central" }
maven { url "https://maven.aliyun.com/repository/jcenter" }
maven { url "https://maven.aliyun.com/repository/google" }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
// maven { url "https://maven.aliyun.com/repository" }
mavenLocal()
mavenCentral()
// google()
// jcenter()
// gradlePluginPortal()
// maven { url 'https://repo1.maven.org/maven2/' }
// maven { url 'https://jitpack.io' }
}
2、因为setting.gradle中有这个配置:
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
所以还要去修改flutter-tools中的配置:
…\FlutterSdk\flutter_windows_3.0.5\packages\flutter_tools\gradle\flutter.gradle
repositories {
maven { url "https://maven.aliyun.com/repository/public" }
maven { url "https://maven.aliyun.com/repository/central" }
maven { url "https://maven.aliyun.com/repository/jcenter" }
maven { url "https://maven.aliyun.com/repository/google" }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
google()
mavenCentral()
}
注意:3.13 以上的版本,需要修改下面两个文件:
flutter_windows_3.13.2\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy
flutter_windows_3.13.2\packages\flutter_tools\gradle\resolve_dependencies.gradle
使用 flutter sdk 3.13 以版本;
使用:
高版本的Gradle配置:
maven { url = uri("https://maven.aliyun.com/repository/public") }
maven { url = uri("https://maven.aliyun.com/repository/central") }
maven { url = uri("https://maven.aliyun.com/repository/jcenter") }
maven { url = uri("https://maven.aliyun.com/repository/google") }
maven { url = uri("https://maven.aliyun.com/repository/gradle-plugin") }