我将此依赖项添加到build.gradle:
repositories { mavenCentral() }
dependencies { compile ('org.smali:dexlib2:2.1.1') }
我确信存在: https://repo1.maven.org/maven2/org/smali/dexlib2/2.1.1/dexlib2-2.1.1.pom
我尝试过:
gradle buildDependents
gradle buildNeeded
gradle build
一切顺利完成,但罐子没有下载,我无法导入课程。
如何检查是否添加了正确的依赖项?
gradle依赖
我是否运行了正确的命令来下载依赖项?
没有用于下载依赖项的命令,它在构建期间是一个自动化任务
--- ---编辑
$ gradle dependencies
:dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
archives - Configuration for archive artifacts.
No dependencies
compile - Compile classpath for source set 'main'.
\--- org.smali:dexlib2:2.1.1
+--- com.google.guava:guava:18.0
+--- org.smali:util:2.1.1
| +--- com.google.guava:guava:18.0
| +--- commons-cli:commons-cli:1.2
| \--- com.google.code.findbugs:jsr305:1.3.9
\--- com.google.code.findbugs:jsr305:1.3.9
default - Configuration for default artifacts.
\--- org.smali:dexlib2:2.1.1
+--- com.google.guava:guava:18.0
+--- org.smali:util:2.1.1
| +--- com.google.guava:guava:18.0
| +--- commons-cli:commons-cli:1.2
| \--- com.google.code.findbugs:jsr305:1.3.9
\--- com.google.code.findbugs:jsr305:1.3.9
runtime - Runtime classpath for source set 'main'.
\--- org.smali:dexlib2:2.1.1
+--- com.google.guava:guava:18.0
+--- org.smali:util:2.1.1
| +--- com.google.guava:guava:18.0
| +--- commons-cli:commons-cli:1.2
| \--- com.google.code.findbugs:jsr305:1.3.9
\--- com.google.code.findbugs:jsr305:1.3.9
testCompile - Compile classpath for source set 'test'.
+--- org.smali:dexlib2:2.1.1
| +--- com.google.guava:guava:18.0
| +--- org.smali:util:2.1.1
| | +--- com.google.guava:guava:18.0
| | +--- commons-cli:commons-cli:1.2
| | \--- com.google.code.findbugs:jsr305:1.3.9
| \--- com.google.code.findbugs:jsr305:1.3.9
\--- junit:junit:4.11
\--- org.hamcrest:hamcrest-core:1.3
testRuntime - Runtime classpath for source set 'test'.
+--- org.smali:dexlib2:2.1.1
| +--- com.google.guava:guava:18.0
| +--- org.smali:util:2.1.1
| | +--- com.google.guava:guava:18.0
| | +--- commons-cli:commons-cli:1.2
| | \--- com.google.code.findbugs:jsr305:1.3.9
| \--- com.google.code.findbugs:jsr305:1.3.9
\--- junit:junit:4.11
\--- org.hamcrest:hamcrest-core:1.3
(*) - dependencies omitted (listed previously)
BUILD SUCCESSFUL
答案 0 :(得分:0)
看起来一切都很好,并且jar被下载到gradle缓存中。
要查看文件在本地的位置,您始终可以解析配置并显示文件位置。例如。像这样
task showJarLocations {
doLast {
configurations.compile.resolve().each { file ->
println file.canonicalPath
}
}
}