解决 gradle 下载各种库,因为有墙的存在而下载不下来的问题,一般都可以解决,采用 阿里云 maven 仓库,配置如下。
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { // google() maven{ url 'https://maven.aliyun.com/repository/google'} maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} maven{ url 'https://maven.aliyun.com/repository/public'} maven{ url 'https://maven.aliyun.com/repository/jcenter'} jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.0' //根据自己的版本走,最大设置为 studio 的版本号 // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { // google() maven{ url 'https://maven.aliyun.com/repository/google'} maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} maven{ url 'https://maven.aliyun.com/repository/public'} maven{ url 'https://maven.aliyun.com/repository/jcenter'} jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
转载地址https://blog.csdn.net/pigdreams/article/details/52626794