The import com.google.api.client cannot be resolved in Eclipse

29,479

Solution 1

You haven't added the client libraries in your project. http://code.google.com/p/google-api-java-client/wiki/Setup. You will get the google-api-java-client-1.14.1-beta.zip file at the above link. Save those jar files in your libs folder of Android project.

Solution 2

Add this:

<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
<dependency>
    <groupId>com.google.api-client</groupId>
    <artifactId>google-api-client</artifactId>
    <version>1.23.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty -->
<dependency>
    <groupId>com.google.oauth-client</groupId>
    <artifactId>google-oauth-client-jetty</artifactId>
    <version>1.23.0</version>
</dependency>

Solution 3

If you are trying to add a Google API to an Android app as I was, and if you are using Eclipse, the following is very easy.

Right-click on a project, select "Google > Add Google APIs...", select the Google API you need from the list of available Google APIs, click Finish, and it will automatically download the API client library

From https://code.google.com/p/google-api-java-client/wiki/Setup

Share:
29,479
Alexis
Author by

Alexis

Updated on January 19, 2020

Comments

  • Alexis
    Alexis over 4 years

    I am getting this error:

    The import com.google.api.client cannot be resolved

    My configuration is below:

    Project Properties - Android:

    enter image description here

    Java Build Path:

    enter image description here

    I still get the error below even after restarting Eclipse.

    enter image description here

    Can anyone help? Thx :D