使用Android studio 新建项目;
在引入GitHub三方库时报错:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
解决方法:
settings.gradle默认是这样的
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "My App"
include ':app'
这里要删除jcenter(),并加上jitpack仓库,最后同步下项目就好。
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "My App"
include ':app'
具体原因:
以前仓库配置都在项目build.gradle文件中,这次默认变到settings.gradle文件了。可能是使用Gradle7.0.3引起的。