android - 如何将 Cloud Endpoints 生成的 sources.jar 库移动到 Android 项目中

标签 android google-cloud-endpoints

Google Plugin for Eclipse 包含一个自动生成云端点客户端库的工具。但是似乎没有一种简单的方法可以将生成的 source.jar 文件移动到您的 Android 源代码中。

文档 https://developers.google.com/appengine/docs/java/endpoints/consume_android

The Endpoints generation results in a sources jar file. Add the contents of this jar file to your Android project.

似乎不可能将 source.jar 文件放入 Android/lib 或/libs,因为源是 .java 而不是 .class 形式。所以我只是手动复制 GPE 生成的源代码(它们放在 AppEngine 项目的 endpoints-lib 文件夹中)。这可能会非常麻烦,尤其是当您拥有多个端点并且经常对其进行编辑时。

另见 Error connecting android app to Google Cloud Endpoints: could not find class

有谁知道在 Android 项目中直接使用 sources.jar 文件的方法吗?谢谢。

最佳答案

这个问题在 Eclipse 中通过在

的目录中添加链接资源来解决

your-appengine-project/endpoint-libs/libYourEndpoint-v1/yourendpoint/yourendpoint-generated-source/

您可以在 Eclipse 中通过在 Properties->Java Build Path->Source Link 中添加源链接来执行此操作

在此之后,您的 Android 或客户端项目将看到使用“Google->生成客户端端点库”生成的任何更改

关于android - 如何将 Cloud Endpoints 生成的 sources.jar 库移动到 Android 项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15393625/

相关文章:

android - 安装两个不同版本的应用程序的apk

android - TextView 下划线电话号码和超链接

java - 如何基于 Google Cloud Endpoints 为 API 编写测试?

java - GoogleAuthUtil.getToken Android 客户端 - Google Cloud Endpoints

android - 在 Android 上实现益智游戏

java - 将修改后的xml保存到Android内部存储中

google-app-engine - Google Cloud Endpoints : java. io.IOException:无法检索状态为:500 的 API 配置

android - 如何使用 Android Studio 0.8 对 Google Cloud Endpoints Java 进行单元测试

java - 有关 Cloud Endpoints 返回类型的更多信息