gradle切换为阿里云镜像

build.gradle 默认的仓库为

buildscript {
 。。。。。。。
    repositories {
        google()
        jcenter()
    }

。。。。。。。
}

使用起来非常不便。于是将源换成阿里云的源,
打开 https://maven.aliyun.com,会转到https://maven.aliyun.com/mvn/view
选择几个加入到配置文件就可以。

buildscript {
   。。。。。。。
    repositories {
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
    }

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

allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
    }
}

如有Flutter,找到flutter安装目录下的 packages\flutter_tools\gradle\flutter.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

修改为:

buildscript {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.2'
    }
}

你可能感兴趣的:(idea,and,android,studio,android)