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)
参考:文章来源:https://www.toymoban.com/news/detail-614042.html
flutter运行一直显示Running Gradle task 'assembleDebug'.文章来源地址https://www.toymoban.com/news/detail-614042.html
到了这里,关于flutter项目运行时一直卡在Running Gradle task ‘assembleDebug‘解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!