Intellij idea Intellij下载渐变依赖项,但无法解析符号
当我尝试使用build.gradle Intellij中列出的依赖项时,无法生成代码并引发错误Intellij idea Intellij下载渐变依赖项,但无法解析符号,intellij-idea,gradle,Intellij Idea,Gradle,当我尝试使用build.gradle Intellij中列出的依赖项时,无法生成代码并引发错误java:not find symbol。如何让Intellij识别我的依赖关系 附言:lbrary出现在“外部库”中,我的所有其他依赖项也有这个问题 在我的build.gradle中,我有: ... dependencies { ... compile 'com.squareup.okhttp:okhttp:2.1.0' } 在我的代码中,我尝试使用以下库: import com.s
java:not find symbol
。如何让Intellij识别我的依赖关系
附言:lbrary出现在“外部库”中,我的所有其他依赖项也有这个问题
在我的build.gradle中,我有:
...
dependencies {
...
compile 'com.squareup.okhttp:okhttp:2.1.0'
}
在我的代码中,我尝试使用以下库:
import com.squareup.okhttp.OkHTTPClient;
...
OkHTTPClient client = new OkHTTPClient();
两行都出现错误
从注释编辑:命令行生成失败,出现了相同的错误,我想我错把责任归咎于Intellij。我如何知道为什么没有下载依赖项?正如我所展示的,它们位于依赖项中的build.gradle中。在编译、默认、运行时、testCompile和testRuntime下运行
gradle dependencies
时,它们也存在,但不存在存档。这就是问题所在吗
EDIT2:gradle依赖项的输出:
:dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
archives - Configuration for archive artifacts.
No dependencies
compile - Classpath for compiling the main sources.
+--- com.google.code.gson:gson:2.3.1
\--- com.squareup.okhttp:okhttp:2.1.0
\--- com.squareup.okio:okio:1.0.1
default - Configuration for default artifacts.
+--- com.google.code.gson:gson:2.3.1
\--- com.squareup.okhttp:okhttp:2.1.0
\--- com.squareup.okio:okio:1.0.1
runtime - Classpath for running the compiled main classes.
+--- com.google.code.gson:gson:2.3.1
\--- com.squareup.okhttp:okhttp:2.1.0
\--- com.squareup.okio:okio:1.0.1
testCompile - Classpath for compiling the test sources.
+--- com.google.code.gson:gson:2.3.1
+--- com.squareup.okhttp:okhttp:2.1.0
| \--- com.squareup.okio:okio:1.0.1
\--- junit:junit:4.11
\--- org.hamcrest:hamcrest-core:1.3
testRuntime - Classpath for running the compiled test classes.
+--- com.google.code.gson:gson:2.3.1
+--- com.squareup.okhttp:okhttp:2.1.0
| \--- com.squareup.okio:okio:1.0.1
\--- junit:junit:4.11
\--- org.hamcrest:hamcrest-core:1.3
BUILD SUCCESSFUL
Total time: 1.82 secs
仔细检查这些库是否确实可以被解析,Gradle命令行构建是否成功。命令行构建失败并出现同样的错误,我想我错把责任归咎于Intellij。我如何知道为什么没有下载依赖项?正如我所展示的,它们位于依赖项中的build.gradle中。当运行
gradle dependencies
时,它们也会出现。在compile、default、runtime、testCompile和testRuntime下,但不在archives下。这就是问题所在吗?没关系。但是,gradle dependencies
应该显示哪些依赖项无法解析。您是否声明了存储库?gradle dependencies
没有说明没有解析依赖关系。我将把它的输出放在原来的帖子里。我不清楚是什么原因造成的。也许可以尝试下载gradleall
附带的一些示例构建。