有没有人想出在哪里获取库来编译https://developers.google.com/drive/quickstart-android#step_4_set_up_the_sample?
他们在同一页面上解释了如何通过 Eclipse 获取 Drive API v2 库。我没有使用 Eclipse 并且使用 IDE 获取库对于程序员(自动化、构建服务器等)来说看起来不合适。尽管我无法找到任何带有库的 Maven 存储库。实际上我不确定它应该是什么工件名称(或全套罐子)。
任何帮助表示赞赏。
有没有人想出在哪里获取库来编译https://developers.google.com/drive/quickstart-android#step_4_set_up_the_sample?
他们在同一页面上解释了如何通过 Eclipse 获取 Drive API v2 库。我没有使用 Eclipse 并且使用 IDE 获取库对于程序员(自动化、构建服务器等)来说看起来不合适。尽管我无法找到任何带有库的 Maven 存储库。实际上我不确定它应该是什么工件名称(或全套罐子)。
任何帮助表示赞赏。
所有 Google API 都在那里: http ://code.google.com/p/google-api-java-client/
不幸的是,根据我自己的搜索,Drive SDK v2 目前仍处于测试阶段(2012 年 12 月),只能通过 Eclipse 获得。
问候
编辑:看这里!!!
最后我想出了如何使用来自 Maven 的 Google Drive 库。
Google Drive 所需的基本 Google 客户端 api 库位于 Maven 中心。实际上在 google code maven repo中有 1.8.0 版本的 Google API Services v2 库。此存储库应包含在 pom.xml 中:
<repository>
<id>google-api-services</id>
<url>http://mavenrepo.google-api-java-client.googlecode.com/hg</url>
</repository>
除了 Google Drive 库本身,还需要一些基础 API 库。这是桌面的 mvn:
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.12.0-beta</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson</artifactId>
<version>1.12.0-beta</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v2-rev13-1.8.0-beta</version>
</dependency>
在 Android 上需要更多依赖项,并且应该排除 xpp3 传递依赖项。还需要一些与 google-play-services 相关的握手。
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.12.0-beta</version>
<exclusions>
<exclusion>
<artifactId>xpp3</artifactId>
<groupId>xpp3</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson</artifactId>
<version>1.12.0-beta</version>
<exclusions>
<exclusion>
<artifactId>xpp3</artifactId>
<groupId>xpp3</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-android</artifactId>
<version>1.12.0-beta</version>
<exclusions>
<exclusion>
<artifactId>xpp3</artifactId>
<groupId>xpp3</groupId>
</exclusion>
<exclusion>
<artifactId>google-play-services</artifactId>
<groupId>com.google.android.google-play-services</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.syncloud</groupId>
<artifactId>google-play-services</artifactId>
<version>4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v2-rev13-1.8.0-beta</version>
</dependency>
google-play-services 引用自 Maven Central 中的 google-api-client-android 库。尽管 Maven Central 中既没有真实的 jar 也没有存根 jar。所以你必须排除这种依赖。但是,您仍然必须提供这个 jar。您可以通过 Android SDK Manager 下载它并安装到您的 Maven 存储库中。这就是在我的案例中所做的,我在 Sonatype Maven 存储库的 org.syncloud 中引用了 google-play-services 版本 4(Gingerbread)。
要使用最新的 Google Drive v2 库,必须通过 Eclipse 下载它们并安装到您的 Maven 存储库。这是我在 Syncloud 项目中所做的:
<dependency>
<groupId>org.syncloud</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v2-rev33-1.12.0-beta-SNAPSHOT</version>
</dependency>
结论:在 Android 上使用来自 Maven 的 Google Drive v2 库是可能的。尽管您应该首先完全了解 Google Drive 库和 Google API Client 库之间的所有依赖关系。此外,您还必须在 Maven 中安装一些库,因为 Google 不会将最新的 Google Drive 库和 Google Play Services 库安装到任何 Maven 中。
如果 Google Drive 开发团队的任何人正在阅读这篇文章,请减轻 Maven 中缺少库的痛苦。
他们的 api maven 仓库:
<repository>
<id>googleapis</id>
<url>http://google-api-client-libraries.appspot.com/mavenrepo</url>
</repository>
和示例依赖:
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v2-rev33-1.12.0-beta</version>
</dependency>
他们的 maven repo 不允许列出,但您可以像这样构建 url 来获取 jars: