赞
踩
一不小心从gradle 6.1.1 升级到了 7.2版本
然后再新建一个项目的时候出现了报错的代码(引用第三方库问题)
项目下的Gradle
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
看着一脸懵,然后settings.gradle里面是这样的
pluginManagement { repositories { gradlePluginPortal() google() mavenCentral() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() } } rootProject.name = "xxx" include ':app'
网上找了很多解答 都没解答到位 后面才找到了解决方案
在导入旧版本的第三方库或者编译报错的时候
在settings.gradle中:dependencyResolutionManagement.repositories里面加上这句话即可解决错误
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url("https://jitpack.io")}//这句
}
}
这篇文章只是写给自己看的,到时候后新建项目忘了就回来看看
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。