Java导入com.google.common.io.Files无法解析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20632265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java The import com.google.common.io.Files cannot be resolved
提问by keith Spiteri
I am working on building and running an android application in Eclipse. I have successfully installed the Android kit, along with the google api. I went here: https://developers.google.com/maps/documentation/tracks/authand followed the sample code.
我正在 Eclipse 中构建和运行一个 android 应用程序。我已经成功安装了 Android 套件以及 google api。我去了这里:https: //developers.google.com/maps/documentation/tracks/auth并遵循示例代码。
However both com.google.common.io.Files and com.google.common.base.Preconditions are giving me an error.
但是 com.google.common.io.Files 和 com.google.common.base.Preconditions 都给了我一个错误。
any idea what I need to do next to get this issue resolved please?
知道我接下来需要做什么来解决这个问题吗?
回答by keith Spiteri
To Solve this issue,
为了解决这个问题,
I went to this link : https://code.google.com/p/guava-libraries/wiki/Release14, downloaded the guava jar file. Then I added it to the classpath and compiled successfully..
我去了这个链接:https: //code.google.com/p/guava-libraries/wiki/Release14,下载了番石榴jar文件。然后我将它添加到类路径并成功编译..
回答by Abhijit Bashetti
If you are having a maven project you can add the dependency to the pom.xml
as below.
如果你有一个 Maven 项目,你可以将依赖项添加到pom.xml
下面。
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r05</version>
</dependency>
The above dependency would solve the problem. Please refer the maven repository for the latest versions Maven Repo
上述依赖将解决问题。最新版本请参考 Maven 仓库Maven Repo