我将这个依赖项添加到我的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一切都成功地完成了,但是jar没有被下载,我无法导入类。
如何检查是否添加了正确的依赖项?
等级依赖
我是否运行了下载依赖项的正确命令?
没有下载依赖项的命令,它是构建过程中的自动化任务
编辑
$ 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发布于 2016-04-01 10:00:45
看起来一切都很好,jar被下载到gradle缓存中。
要查看文件在本地的位置,您可以始终解析配置并显示文件位置。就像这样
task showJarLocations {
doLast {
configurations.compile.resolve().each { file ->
println file.canonicalPath
}
}
}https://stackoverflow.com/questions/36352786
复制相似问题