Java The import com.google.common.io.Files cannot be resolved

15,501

Solution 1

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..

Solution 2

If you are having a maven project you can add the dependency to the pom.xml as below.

<!-- 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

Share:
15,501
keith Spiteri
Author by

keith Spiteri

Updated on June 06, 2022

Comments

  • keith Spiteri
    keith Spiteri almost 2 years

    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/auth and followed the sample code.

    However both com.google.common.io.Files and com.google.common.base.Preconditions are giving me an error.

    any idea what I need to do next to get this issue resolved please?