简体   繁体   English

将android应用连接到Google Cloud Endpoints时出错:找不到课程

[英]Error connecting android app to Google Cloud Endpoints: could not find class

I have built an API with Google Cloud Endpoints and I am trying to connect to it writing an Android application. 我已经使用Google Cloud Endpoints构建了一个API,并且试图编写一个Android应用程序来连接到它。 I followed the following tutorial: 我遵循以下教程:

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

So, I added the content of the jar on my "src" folder, I copied the listed libraries to lib and I added the code. 因此,我在“ src”文件夹中添加了jar的内容,将列出的库复制到了lib中,并添加了代码。 When I tried to start the application, it crashed with the following error: 当我尝试启动应用程序时,它崩溃并显示以下错误:

        02-26 12:19:52.874: E/dalvikvm(17558): Could not find class 
    'com.google.api.services.utenteendpoint.Utenteendpoint$Builder', referenced from method 
    com.example.androidgcetest.MainActivity.onCreate


 02-26 12:19:53.004: E/AndroidRuntime(17558): FATAL EXCEPTION: main
02-26 12:19:53.004: E/AndroidRuntime(17558): java.lang.NoClassDefFoundError: com.google.api.services.utenteendpoint.Utenteendpoint$Builder
02-26 12:19:53.004: E/AndroidRuntime(17558):    at com.example.androidgcetest.MainActivity.onCreate(MainActivity.java:22)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.app.Activity.performCreate(Activity.java:4465)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.os.Looper.loop(Looper.java:137)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at android.app.ActivityThread.main(ActivityThread.java:4448)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at java.lang.reflect.Method.invokeNative(Native Method)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at java.lang.reflect.Method.invoke(Method.java:511)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
02-26 12:19:53.004: E/AndroidRuntime(17558):    at dalvik.system.NativeStart.main(Native Method)

Do you know the possible cause of this error? 您知道此错误的可能原因吗?

EDIT: I also found this before the log reported above 编辑:我还发现此之前报告上面的日志

02-26 16:51:57.780: W/dalvikvm(1230): Unable to resolve superclass of Lcom/google/api/services/utenteendpoint/Utenteendpoint$Builder; (20)
02-26 16:51:57.780: W/dalvikvm(1230): Link of class 'Lcom/google/api/services/utenteendpoint/Utenteendpoint$Builder;' failed

Add the sources.jar file also to libs folder of your android project, just like the other jar files. 就像其他jar文件一样,将sources.jar文件也添加到android项目的libs文件夹中。

Thanks Raffo for finding the typo error in my earlier post 感谢Raffo在我较早的帖子中发现了拼写错误

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM