6

我收到此错误:

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

我的配置如下:

项目属性 - Android:

在此处输入图像描述

Java构建路径:

在此处输入图像描述

即使重新启动 Eclipse,我仍然会收到以下错误。

在此处输入图像描述

任何人都可以帮忙吗?谢谢:D

4

3 回答 3

10

您尚未在项目中添加客户端库。 http://code.google.com/p/google-api-java-client/wiki/Setup。您将在上述链接中获得 google-api-java-client-1.14.1-beta.zip 文件。将这些 jar 文件保存在 Android 项目的 libs 文件夹中。

于 2013-03-30T05:32:22.233 回答
2

添加这个:

<!-- 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>
于 2018-05-18T18:54:10.967 回答
1

如果您像我一样尝试将 Google API 添加到 Android 应用程序,并且您使用的是 Eclipse,那么以下操作非常简单。

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

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

于 2013-10-30T03:10:12.150 回答