当前位置: 首页 > news >正文

解决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}
http://www.xdnf.cn/news/256123.html

相关文章:

  • 【AI面试准备】元宇宙测试:AI+低代码构建虚拟场景压力测试
  • InnoDB索引的原理
  • 模型上下文协议(MCP)
  • 学习记录:DAY22
  • 数字智慧方案5873丨智慧交通设计方案(57页PPT)(文末有下载方式)
  • 动态库与静态库的区别
  • 内置类型成员变量的初始化详解
  • PostgreSQL 的 VACUUM 与 VACUUM FULL 详解
  • 6.DOS
  • 数字世界的“私人车道“:网络切片如何用Python搭建专属通信高速路?
  • 情境领导理论——AI与思维模型【89】
  • 单片机-STM32部分:0、学习资料汇总
  • RISCV的smstateen-ssstateen扩展
  • Flutter——数据库Drift开发详细教程(二)
  • 使用python爬取百度搜索中关于python相关的数据信息
  • 重构编程范式:解码字节跳动 AI 原生 IDE Trae 的技术哲学与实践价值
  • 【数据库】四种连表查询:内连接,外连接,左连接,右连接
  • 【Vue】Vue与UI框架(Element Plus、Ant Design Vue、Vant)
  • 传奇各职业/战士/法师/道士手套/手镯/护腕/神秘腰带爆率及出处产出地/圣战/法神/天尊/祈祷/虹魔/魔血
  • Codex CLI轻量级 AI 编程智能体 :openai又放大招了
  • 西游记4:从弼马温到齐天大圣;太白金星的计划;
  • P1308 统计单词数详解
  • 关于CSDN创作的常用模板内容
  • 人车交叉作业防撞系统介绍
  • 第一章:A Primer on Memory Consistency and Cache Coherence - 2nd Edition
  • 通过具体场景、操作示例和实际命令来具象化 Calico 的功能
  • 动态规划之路径问题1
  • 从括号匹配看栈:数据结构入门的实战与原理
  • 中小企业MES系统需求文档
  • 数控滑台:将制造业推向智能化的关键装备