gradle环境问题

2020-11-28  本文已影响0人  码农梦醒

国内gradle无法从gradle官网下载gradle

从网上下载gradle.zip很慢,可以将其下载下来放在本地目录,将.\项目\gradle\wrapper下的gradle-wrapper.properties中

gradle-wrapper.properties引用本地gradle-x.x.x-all.zip

distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

替换成

distributionUrl=file\:///D:/gradle/gradle-2.4-all.zip

配置gradle使用国内镜像下载jar包

修改build.gradle

buildscript {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha13'
    }
}
allprojects {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
上一篇下一篇

猜你喜欢

热点阅读