flutter使用build.gradle国内源解决编译慢问题

编译的时候使用-v显示详情:

flutter run -v

可能会在这里卡住:

Could not resolve all files for configuration 'classpath'

使用国内源方法如下。

文件一:android/app/build.gradle

//...
buildscript {
    repositories {
        //google()
        //jcenter()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/public' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
    }
}

allprojects {
    repositories {
        //google()
        //jcenter()
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/public' }
    }
}
//...

文件二:flutter sdk目录,进入如下目录 flutter/⁨packages⁩/flutter_tools⁩/gradle/flutter.gradle 文件:

//...
buildscript {
     repositories {
         //google()
         //jcenter()
         maven { url 'https://maven.aliyun.com/repository/google' }
         maven { url 'https://maven.aliyun.com/repository/jcenter' }
         maven { url 'https://maven.aliyun.com/repository/public' }
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:3.5.3'
     }
 }
//...

« »

发表评论

电子邮件地址不会被公开。 必填项已用*标注

昵称 *