打开项目根目录下的 build.gradle(Project:项目名称一级的gradle),如下所示添加阿里 maven 库地址:

// 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/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
//        google()
//        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.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/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
//        google()
//        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

参考链接:https://my.oschina.net/who7708/blog/2991973

 

 

 

相关文章:

  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2021-11-20
  • 2021-10-24
  • 2022-12-23
  • 2021-12-21
猜你喜欢
  • 2021-05-29
  • 2022-12-23
  • 2021-04-20
  • 2021-06-14
  • 2022-01-10
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案