一、为工程配置依赖仓库
在 根目录 的 build.gradle 顶层构建脚本 中 , 配置的 allprojects 脚本块 , 是 作用于所有的工程的 ,
<span style="color:#000000"><span style="background-color:#2d2d2d">
</span></span>
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
如果要为单独的 Module 模块配置依赖仓库 , 则在 模块下 的 build.gradle 构建脚本 中配置 repositories 脚本块配置 即可 , 如 :
<span style="color:#000000"><span style="background-color:#2d2d2d">
</span></span>
plugins {
id 'com.android.application'
}
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
android {
compileSdkVersion 32
buildToolsVersion "32.0.0"
}