kaisawind's blog
  • 关于
  • 所有帖子

jcenter访问失败(翻墙) - Sat, Sep 21, 2019

jcenter访问失败(翻墙)

  • 1. 概述
  • 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
}


辽ICP备2021007608号 | © 2025 | kaisawind

Facebook Twitter GitHub