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/