[英]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.