赞
踩
分享一下我收集到的阿里镜像。
因为Android Studio虽然智能但是对于国内开发者确实不友好,每次建工程使用Gradle框架的话都会动态生成一个Gradle版本并从官网上获取,不翻墙的话根本下载不好。所以这时候就需要一个好的镜像为我们提供这一接入服务。
打开上图的build.gradle文件,直接用以下代码覆盖覆盖:
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
-
- buildscript {
- repositories {
- // google()
- // jcenter()
- maven { url 'https://maven.aliyun.com/repository/central' }
- maven { url 'https://maven.aliyun.com/repository/public' }
- maven { url 'https://maven.aliyun.com/repository/google' }
- maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
- // mavenCentral()
- maven { url "https://jitpack.io" }
- google()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:4.0.1'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
- }
-
- allprojects {
- repositories {
- // jcenter()
- // google()
- maven { url 'https://maven.aliyun.com/repository/central' }
- maven { url 'https://maven.aliyun.com/repository/public' }
- maven { url 'https://maven.aliyun.com/repository/google' }
- maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
- // mavenCentral()
- maven {
- url "https://jitpack.io"
- }
- google()
- }
- }
-
- task clean(type: Delete) {
- delete rootProject.buildDir
- }
重点就是那几个maven路径,替换好后关掉Android Studio重启,一般就没什么问题了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。