在android studio中向项目添加后端时的java.lang.NoClassDefFoundError

时间:2015-04-15 04:48:41

标签: java android google-app-engine android-studio sinch

我正在构建一个消息传递应用程序,并使用sinch和解析消息传递客户端。我们按照https://www.sinch.com/tutorials/android-messaging-tutorial-using-sinch-and-parse/中的sinch教程构建了一个简单的信使。

完成此操作后,我按照以下步骤添加了后端:https://cloud.google.com/mobile/app_engine/add_module

首先,gradle不会构建,直到我将multiDexEnabled = true添加到build.gradle(一个我似乎找不到的SO帖子提供修复。

现在gradle构建,后端在localhost:8080.

成功启动

但现在当我运行信使应用程序时,我得到了

  

此行的java.lang.NoClassDefFoundError   usersListView.setOnItemClickListener(新   ListUsersActivity中的AdapterView.OnItemClickListener()。

同样,我收到了LoginActivity的错误:

  

停止未恢复的活动:   {com.myapp / myapp.LoginActivity}       java.lang.RuntimeException:执行停止未恢复的活动

我非常困惑,因为应用程序在添加简单的后端之前运行正常,后端似乎正在运行。如果还有其他我可以提供的帮助来追踪这一点,请告诉我。我已经用谷歌搜索了我的屁股并且什么都没有。

编辑:错误日志低于

04-15 12:29:02.811    4148-4148/com.myapp E/ActivityThread﹕ Performing stop of activity that is not resumed: {com.myapp/com.myapp.LoginActivity}
    java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.anykilline.killine/com.myapp.LoginActivity}
            at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3356)
            at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3443)
            at android.app.ActivityThread.access$1200(ActivityThread.java:169)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5476)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
            at dalvik.system.NativeStart.main(Native Method)
04-15 12:29:03.781    4148-4292/com.myapp I/System.out﹕ ParseRequest.NETWORK_EXECUTOR-thread-1 calls detatch()
04-15 12:29:03.791    4148-4148/com.myapp D/AndroidRuntime﹕ Shutting down VM
04-15 12:29:03.791    4148-4148/com.myapp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x417fcda0)
04-15 12:29:03.791    4148-4309/com.myappI/System.out﹕ ParseRequest.NETWORK_EXECUTOR-thread-2 calls detatch()
04-15 12:29:03.791    4148-4148/com.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.myapp, PID: 4148
    java.lang.NoClassDefFoundError: com.myapp.ListUsersActivity$2$1
            at com.anykilline.killine.ListUsersActivity$2.done(ListUsersActivity.java:76)
            at com.parse.FindCallback.internalDone(FindCallback.java:45)
            at com.parse.FindCallback.internalDone(FindCallback.java:31)
            at com.parse.Parse$6$1.run(Parse.java:917)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5476)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
            at dalvik.system.NativeStart.main(Native Method)

编辑2: 看到一篇SO帖子,表明构建顺序可能不稳定。因此,我删除了我的构建文件夹并进行了干净的构建。仍然有错误,但他们现在已经改变了:

04-15 14:09:06.889  25184-25184/com.myapp E/dalvikvm﹕ Could not find class 'com.myapp.LoginActivity$1$1', referenced from method com.myapp.LoginActivity$1.onClick
04-15 14:09:06.889  25184-25184/com.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 1752 (Lcom/anykilline/killine/LoginActivity$1$1;) in Lcom/anykilline/killine/LoginActivity$1;
04-15 14:09:06.889  25184-25184/com.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0032
04-15 14:09:06.889  25184-25184/com.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x3baf at 0x34 in Lcom/anykilline/killine/LoginActivity$1;.onClick
04-15 14:09:06.889  25184-25184/com.myapp E/dalvikvm﹕ Could not find class 'com.myapp.LoginActivity$2$1', referenced from method com.myapp.LoginActivity$2.onClick
04-15 14:09:06.889  25184-25184/com.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 1754 (Lcom/anykilline/killine/LoginActivity$2$1;) in Lcom/anykilline/killine/LoginActivity$2;
04-15 14:09:06.889  25184-25184/com.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x003d
04-15 14:09:06.889  25184-25184/com.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0x3bb2 at 0x3f in Lcom/anykilline/killine/LoginActivity$2;.onClick
04-15 14:09:06.889  25184-25184/com.myapp E/dalvikvm﹕ Could not find class 'com.sinch.android.rtc.DefaultSinchClientBuilder', referenced from method com.sinch.android.rtc.Sinch.getSinchClientBuilder
04-15 14:09:06.889  25184-25184/com.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 8798 (Lcom/sinch/android/rtc/DefaultSinchClientBuilder;) in Lcom/sinch/android/rtc/Sinch;
04-15 14:09:06.889  25184-25184/com.myapp D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
04-15 14:09:06.889  25184-25184/com.myapp D/dalvikvm﹕ DexOpt: unable to opt direct call 0xf429 at 0x02 in Lcom/sinch/android/rtc/Sinch;.getSinchClientBuilder
04-15 14:09:06.889  25184-25184/com.myapp D/AndroidRuntime﹕ Shutting down VM
04-15 14:09:06.899  25184-25184/com.myapp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x417fcda0)
04-15 14:09:06.899  25184-25184/com.myapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.myapp, PID: 25184
    java.lang.NoClassDefFoundError: com.sinch.android.rtc.DefaultSinchClientBuilder
            at com.sinch.android.rtc.Sinch.getSinchClientBuilder(Sinch.java:15)
            at com.myapp.MessageService.startSinchClient(MessageService.java:46)
            at com.myapp.MessageService.onStartCommand(MessageService.java:37)
            at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2883)
            at android.app.ActivityThread.access$2200(ActivityThread.java:169)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1374)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5476)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
            at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案