写项目的时候经常会需要使用别人集成好的第三方库来提高开发效率,可是经常会导入不成功,提示Failed to Resolve:xxxxxx…这个时候就很烦。就需要不断在网上找解决办法,最后找了一圈发现根本就解决不了,这个时候就很让人崩溃。
出现的问题
Failed to Resolved:'com.github.LuckSiege.PictureSelector:picture_library:v2.6.0'
找了很多资料都说是在build.gradle(project)目录下加上 这一行。
repositories {
...
maven { url 'https://jitpack.io'}
}
可是导入了,发现还是报一样的错误,并不能够解决问题。
解决办法
实际上是加上上面那一行代码就能解决问题,但是由于Android Studio版本升级的问题,现在需要把这行代码加在settings.gradle文件里:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url 'https://jitpack.io'}
}
}
这样操作就能导入成功了。