简体   繁体   English

Android Studio:如何设置生成的Cloud Endpoints资源?

[英]Android Studio: how to setup generated Cloud Endpoints sources?

I built a Cloud Endpoints API using AppEngine/Python (not with the Java wizard from Android Studio), then I generated the libs and sources, copied the libs stated in the tutorial to libs/ and extracted the sources.jar file to src/ 我使用AppEngine / Python构建了一个Cloud Endpoints API(不是来自Android Studio的Java向导),然后我生成了libs和源代码,将教程中陈述的lib复制到libs /并将sources.jar文件解压缩到src /

adding to build.gradle: compile fileTree(dir: 'libs', include: '*.jar') 添加到build.gradle: compile fileTree(dir: 'libs', include: '*.jar')

the problem I'm now facing is: 我现在面临的问题是:

08-04 19:40:53.756    2052-2052/com.dgt.ddst E/dalvikvm: Could not find class 'com.google.api.services.dsApi.DsApi$Builder', referenced from method com.dgt.ds.MainActivity$1.doInBackground
08-04 19:40:53.756    2052-2052/com.dgt.ds E/dalvikvm: Could not find class 'com.google.api.services.dsApi.model.ServicesDResponse', referenced from method com.dgt.ds.MainActivity$1.onPostExecute

I searched for solutions and all I could find are things related to Eclipse. 我搜索了解决方案,所有我能找到的东西都与Eclipse有关。

how do I fix this in the Android Studio/Gradle environment ? 如何在Android Studio / Gradle环境中修复此问题?

This is how I did it, maybe it is not the best way but I couldn't find a better one: 这就是我做到的,也许这不是最好的方式,但我找不到更好的方法:

  • First generate your client library for gradle: 首先为gradle生成客户端库:

    google_appengine/endpointscfg.py get_client_lib java -bs gradle your_module.YourServiceClass google_appengine / endpointscfg.py get_client_lib java -bs gradle your_module.YourServiceClass

  • Uncompress the generated zip file, this will create a folder call your_module 解压缩生成的zip文件,这将创建一个调用your_module的文件夹

  • In Android Studio load the Android app you want to work with your endpoints module 在Android Studio中加载您要使用端点模块的Android应用

  • Go to File -> Project Structure. 转到文件 - >项目结构。 Add a new module selecting "Import existing project". 添加一个新模块,选择“导入现有项目”。 Point the source folder to your_module folder and then press finish. 将源文件夹指向your_module文件夹,然后按完成。

  • Android Studio will go back to the Project Structure window, select your Android app module and go to the dependencies tab. Android Studio将返回“项目结构”窗口,选择您的Android应用程序模块并转到“依赖项”选项卡。 Add a new "Module dependency" and select your_module. 添加一个新的“模块依赖项”并选择your_module。

  • Re-sync gradle and rebuild your project and that's all! 重新同步gradle并重建您的项目,这就是全部!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Cloud Endpoints生成的sources.jar库移动到Android项目中 - How to move Cloud Endpoints generated sources.jar library into Android project 如何在Android Studio中使用Google端点写入Cloud SQL - How to write to Cloud SQL with Google Endpoints in Android Studio 如何在Android Studio中的多个项目中重用Google Cloud端点 - How to reuse google cloud endpoints in multiple projects in android studio Android Studio集成了Google端点生成的库 - Android Studio Integrating Google Endpoints Generated libraries 使用Android Studio的Google Cloud Endpoints对冒号(:)进行编码 - Encoding of colon (:) with Google Cloud Endpoints, Android Studio 如何使用生成的客户端库在 Android 中取消谷歌云端点请求? - How to cancel google cloud endpoints request in Android using the generated client library? 在Android Studio中使用云端点开发android API后端 - Developing an android API backend with cloud endpoints in Android Studio 如何在intellij中设置android源? - how do I setup android sources in intellij? 如何使用Android Studio 0.8对Google Cloud Endpoints Java进行单元测试 - How to Unit Test Google Cloud Endpoints Java Using Android Studio 0.8 Google Cloud Endpoints设置问题 - Google Cloud Endpoints Setup Trouble
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM