jcenter访问失败(翻墙)

  1. 1. 概述
  2. 2. 使用aliyun代理

1. 概述

jcenter是一个由bintray.com维护的Maven仓库,国内访问有时候会出错。
example代码位置: example

2. 使用aliyun代理

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        // 阿里云 maven 地址
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public' }
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        google()
        // jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        // 阿里云 maven 地址
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public' }
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        google()
        // jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 wind.kaisa@gmail.com

💰

×

Help us with donation