每次开发android 都得面临各种依赖下载失败的问题,每次都得去网上搜各种仓库地址,这里记录一下,省的找不着。在项目根目录下build.gradle中配置的代码如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript { repositories { maven { url ‘https://maven.aliyun.com/repository/central’ } maven { url ‘https://maven.aliyun.com/repository/jcenter’ } 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://jitpack.io’ } google() jcenter() } dependencies { classpath “com.android.tools.build:gradle:4.1.1” // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }}allprojects { repositories { maven { url ‘https://maven.aliyun.com/repository/central’ } maven { url ‘https://maven.aliyun.com/repository/jcenter’ } 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://mapbox.bintray.com/mapbox’ } maven { url ‘https://jitpack.io’ } maven {// 专为Mapbox配置 url ‘https://api.mapbox.com/downloads/v2/releases/maven’ authentication { basic(BasicAuthentication) } credentials { // Do not change the username below. // This should always be `mapbox` (not your username). username = ‘mapbox’ // Use the secret token you stored in gradle.properties as the password password = project.properties[‘MAPBOX_DOWNLOADS_TOKEN’] ?: “” } } google() jcenter() }}task clean(type: Delete) { delete rootProject.buildDir}