欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > 名人名企 > 解决Flutter项目中Gradle构建Running Gradle task ‘assembleDebug‘卡顿问题的终极指南

解决Flutter项目中Gradle构建Running Gradle task ‘assembleDebug‘卡顿问题的终极指南

2025/5/5 12:37:12 来源:https://blog.csdn.net/nyasm/article/details/147669930  浏览:    关键词:解决Flutter项目中Gradle构建Running Gradle task ‘assembleDebug‘卡顿问题的终极指南

解决Flutter项目中Gradle构建Running Gradle task ‘assembleDebug‘卡顿问题的终极指南

前言

在开发Flutter应用时,经常会遇到Gradle构建卡在Running Gradle task 'assembleDebug'阶段的问题。本文将分享如何通过配置华为云镜像和使用自定义脚本下载依赖的方法解决这些问题。

问题描述

典型错误如下:

FAILURE: Build failed with an exception.* Where:
Settings file 'android/settings.gradle.kts' line: 28* What went wrong:
Error resolving plugin [id: 'dev.flutter.flutter-plugin-loader', version: '1.0.0']
> A problem occurred configuring project ':gradle'.> Could not resolve all artifacts for configuration ':gradle:classpath'.> Could not download kotlin-compiler-embeddable-1.9.24.jar> Could not get resource 'https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.9.24/kotlin-compiler-embeddable-1.9.24.jar'.

或者构建过程长时间卡在:

Configuration on demand is an incubating feature.
<-------------> 0% INITIALIZING [26s]
> Evaluating settings

解决方案1: 配置华为云镜像

步骤1: 修改settings.gradle.kts

pluginManagement {val flutterSdkPath = run {val properties = java.util.Properties()file("local.properties").inputStream().use { properties.load(it) }val flutterSdkPath = properties.getProperty("flutter.sdk")require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }flutterSdkPath}includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")repositories {// 优先使用华为云镜像maven {url = uri("https://mirrors.huaweicloud.com/repository/maven")isAllowInsecureProtocol = true}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词