当前位置:   article > 正文

Flutter编译卡在Running Gradle task ‘assembleDebug_running gradle task 'assembledebug'...

running gradle task 'assembledebug'...

1、翻墙

2、修改国内镜像源(以下以Flutter 3.19.3版本为例)

  1. 找到Flutter SDK目录下的Flutter配置文件resolve_dependencies.gradle

        路径:flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle

        1)、第一处修改:

                google()
                mavenCentral()

               改为:

                maven { url 'https://maven.aliyun.com/repository/central' }
                maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
                maven { url 'https://maven.aliyun.com/repository/google' }
                maven { url 'https://maven.aliyun.com/repository/public'}

        2)、第二处修改:

                url "$storageUrl/${engineRealm}download.flutter.io"

                改为:url "https://mirrors.tuna.tsinghua.edu.cn/flutter/download.flutter.io"

       2. 找到Flutter SDK目录下的Flutter配置文件flutter.groovy

        地址为: flutter/packages/flutter_tools/gradle/src/main/groovy

                1)、第一处修改

                google()
                mavenCentral()

               改为:

                maven { url 'https://maven.aliyun.com/repository/central' }
                maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
                maven { url 'https://maven.aliyun.com/repository/google' }
                maven { url 'https://maven.aliyun.com/repository/public'}

                2)、第二处修改

                DEFAULT_MAVEN_HOST = "https://storage.googleapis.com";        

                改为:DEFAULT_MAVEN_HOST = "https://mirrors.tuna.tsinghua.edu.cn/flutter"

        3.修改项目根目录下Android/build.gradle文件镜像地址

                google()
                mavenCentral()

               改为:

                maven { url 'https://maven.aliyun.com/repository/central' }
                maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
                maven { url 'https://maven.aliyun.com/repository/google' }
                maven { url 'https://maven.aliyun.com/repository/public'}

        4.修改项目gradle下载地址 

            路径:项目根目录/android/gradle/wrapper/gradle-wrapper.properties

                改:

        https\://services.gradle.org/distributions/gradle-xx.zip

                为:

        https://mirrors.cloud.tencent.com/gradle/gradle-xx.zip

over!

        

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/613571
推荐阅读
相关标签
  

闽ICP备14008679号