2

我已经使用 Google Cloud Endpoints 构建了一个 API,并且正在尝试连接到它并编写一个 Android 应用程序。我按照以下教程进行操作:

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

因此,我在“src”文件夹中添加了 jar 的内容,将列出的库复制到 lib 并添加了代码。当我尝试启动应用程序时,它崩溃并出现以下错误:

        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)

你知道这个错误的可能原因吗?

编辑:我在上面报告的日志之前也发现了这个

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
4

1 回答 1

1

将sources.jar 文件也添加到您的android 项目的libs 文件夹中,就像其他jar 文件一样。

感谢 Raffo 在我之前的帖子中发现拼写错误

于 2013-02-28T12:42:25.707 回答