美文网首页
Flutter运行一直卡在 Running Gradle tas

Flutter运行一直卡在 Running Gradle tas

作者: 下线的时候 | 来源:发表于2023-03-30 10:17 被阅读0次

    1.找到fultter SDK所在文件夹的位置:依次进入 flutter/packages/flutter_tools/gradle 文件夹

    1.1将buildscript repositories 下面的

      buildscript {
        repositories {
            google()
            mavenCentral()
    
        }
        ...
    }
    

    修改为

      buildscript {
        repositories {
            maven { url 'https://maven.aliyun.com/repository/google' }
            maven { url 'https://maven.aliyun.com/repository/jcenter' }
            maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
    
        }
        ...
    }
    

    1.2 将DEFAULT_MAVEN_HOST 值修改成 "https://storage.flutter-io.cn"

    private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn";
    

    2 回到当前项目中,将android/build.gradle 文件中两处google() ,jcenter()替换掉,

    buildscript {
       ...
        repositories {
    //        google()
    //        mavenCentral()
            maven { url 'https://maven.aliyun.com/repository/google' }
            maven { url 'https://maven.aliyun.com/repository/jcenter' }
            maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
    
        }
    
       ...
    }
    
    allprojects {
        repositories {
    //        google()
    //        mavenCentral()
            maven { url 'https://maven.aliyun.com/repository/google' }
            maven { url 'https://maven.aliyun.com/repository/jcenter' }
            maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
    
        }
    }
    

    3、clean后重新运行

    相关文章

      网友评论

          本文标题:Flutter运行一直卡在 Running Gradle tas

          本文链接:https://www.haomeiwen.com/subject/tvwqddtx.html