赞
踩
1.修改项目中的android/build.gradle,将google(),mavenCentral()替换为下面的代码
- maven { url 'https://maven.aliyun.com/repository/central/' }
- maven { url 'https://maven.aliyun.com/repository/public/' }
- maven { url 'https://maven.aliyun.com/repository/google/' }
- maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
2.找到flutter的安装路径,找到packages\flutter_tools\gradle下的flutter.gradle文件,找到buildscript对象,对里面的repositories内容进行修改,换成以下代码
- buildscript {
- repositories {
- maven { url 'https://maven.aliyun.com/repository/central/' }
- maven { url 'https://maven.aliyun.com/repository/public/' }
- maven { url 'https://maven.aliyun.com/repository/google/' }
- maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
-
- dependencies {
- /** When bumping, also update ndkVersion above, as well as the Android Gradle Plugin
- * version in ../lib/src/android/gradle_utils.dart.
- */
- classpath 'com.android.tools.build:gradle:7.3.0'
- }
- }
3.依然在flutter.gradle文件中使用“ctrl+F”搜索DEFAULT_MAVEN_HOST,修改为以下代码
private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
(本文的flutter版本为Flutter 3.10.6)
参考:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。