在Android Studio中添加XML文件时出现红色下划线。如何解决? 它显示:Unable to resolve dependency for ':app@debug/compileClasspath':Could not resolve com.github.smarteist:autoimageslider:1.4.0
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// e.g this is how you would add jitpack
maven { url "https://jitpack.io" }
// Add any repositories you would be adding to all projects here
}
}
2条答案
按热度按时间0h4hbjxa1#
检查您的build.gradle中是否缺少jcenter(),如果需要,请添加它。
enter image description here
dsf9zpds2#
您需要在settings.gradle内的dependencyResolutionManagement中添加依赖项。
自7.X.X gradle构建工具起,allprojects已被弃用使用dependencyResolutionManagement是声明存储库的最佳实践。
因此,Android项目将不再在其项目build.gradle文件中生成allprojects块,而是在settings.gradle中生成dependencyResolutionManagement块。