Android项目的build.gradle配置依赖仓库链接的文件变到setting.gradle中了
Posted LQS_Android
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android项目的build.gradle配置依赖仓库链接的文件变到setting.gradle中了相关的知识,希望对你有一定的参考价值。
原来配置依赖仓库链接的文件是build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
repositories
google()
jcenter()
maven url "https://jitpack.io"
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
google()
maven url "https://jitpack.io"
jcenter()
task clean(type: Delete)
delete rootProject.buildDir
现在新建使用组件DataBinding、View Model、Navigation导航的Android新项目时,这个文件不再有如下这些配置依赖库的链接对象体、函数了:
buildscript
repositories
google()
jcenter()
maven url "https://jitpack.io"
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
google()
maven url "https://jitpack.io"
jcenter()
你需要将他们配置到setting.gradle文件中:
pluginManagement
repositories
gradlePluginPortal()
google()
jcenter()
maven url "https://jitpack.io"
mavenCentral()
dependencyResolutionManagement
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories
google()
jcenter()
maven url "https://jitpack.io"
mavenCentral()
rootProject.name = "BigBookshelf"
include ':app'
以上是关于Android项目的build.gradle配置依赖仓库链接的文件变到setting.gradle中了的主要内容,如果未能解决你的问题,请参考以下文章
Android学习之基础知识二(build.gradle文件详解)
Android Gradle 插件Gradle 基础配置 ② ( Gradle 空白项目构建示例演示 )