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

2019-03-28 12:29发布

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

3条回答
Evening l夕情丶
2楼-- · 2019-03-28 13:11

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.

查看更多
爷的心禁止访问
3楼-- · 2019-03-28 13:12

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>
查看更多
劳资没心,怎么记你
4楼-- · 2019-03-28 13:21

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

查看更多
登录 后发表回答