无法解析:de.hdodenhof:circleimageview:2.1.0 [英] Failed to resolve: de.hdodenhof:circleimageview:2.1.0
问题描述
尝试添加两个 Maven 存储库,但似乎无法解决此问题.
找不到有关 stackoverflow 的任何信息,想知道在 Gradle 中解决依赖项的标准方法是什么
Tried adding both maven repositories but can't seem to get this to resolve.
Couldn't find any info on stackoverflow and was wondering what is the standard way to resolve dependencies in Gradle
root build.gradle
Root build.gradle
buildscript {
repositories {
mavenCentral()
// maven { url "https://mvnrepository.com/artifact/de.hdodenhof/circleimageview" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
模块 build.gradle
Module build.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
// compile files('libs/CircleImageView-master/gradle/wrapper/gradle-wrapper.jar')
compile 'de.hdodenhof:circleimageview:2.1.0'
}
无法解析:de.hdodenhof:circleimageview:2.1.0
Failed to resolve: de.hdodenhof:circleimageview:2.1.0
推荐答案
我可以下载问题中所写的依赖项.不过,作为参考,这里是我项目的 build.gradle.我认为您需要 allprojects
部分.我遇到了如果没有它就无法解决依赖关系的问题.
I can download that dependency as written in the question. For reference, though, here is my project's build.gradle. I think you need the allprojects
piece. I've had problems where dependencies wouldn't resolve without that.
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
}
附加说明:如果您要编译克隆的存储库,请执行以下操作
An additional note: If you were to compile the cloned repo, you do it something like this
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(":CircleImageView-master:circleimageview")
...
}
settings.gradle 的位置
Where the settings.gradle would have
include ':app', ':CircleImageView-master:circleimageview'
这篇关于无法解析:de.hdodenhof:circleimageview:2.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!