如何解决" java.lang.NoClassDefFoundError#34;?

时间:2014-04-01 16:49:35

标签: java android

我收到了错误消息。这是日志:

04-01 22:04:41.010: I/dalvikvm(19541): Could not find method com.quickblox.module.chat.smack.SmackAndroid.init, referenced from method com.quickblox.videochatsample.ui.App.onCreate
04-01 22:04:41.010: W/dalvikvm(19541): VFY: unable to resolve static method 13789: Lcom/quickblox/module/chat/smack/SmackAndroid;.init (Landroid/content/Context;)Lcom/quickblox/module/chat/smack/SmackAndroid;
04-01 22:04:41.010: D/dalvikvm(19541): VFY: replacing opcode 0x71 at 0x0003
04-01 22:04:41.010: D/AndroidRuntime(19541): Shutting down VM
04-01 22:04:41.010: W/dalvikvm(19541): threadid=1: thread exiting with uncaught exception (group=0x40c11a68)
04-01 22:04:41.020: E/AndroidRuntime(19541): FATAL EXCEPTION: main
04-01 22:04:41.020: E/AndroidRuntime(19541): java.lang.NoClassDefFoundError: com.quickblox.module.chat.smack.SmackAndroid
04-01 22:04:41.020: E/AndroidRuntime(19541):    at com.quickblox.videochatsample.ui.App.onCreate(App.java:13)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:973)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3971)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at android.app.ActivityThread.access$1300(ActivityThread.java:128)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at android.os.Looper.loop(Looper.java:137)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at android.app.ActivityThread.main(ActivityThread.java:4517)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at java.lang.reflect.Method.invokeNative(Native Method)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at java.lang.reflect.Method.invoke(Method.java:511)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
04-01 22:04:41.020: E/AndroidRuntime(19541):    at dalvik.system.NativeStart.main(Native Method)  

代码:

package com.quickblox.videochatsample.ui;

import android.app.Application;

import com.quickblox.module.chat.smack.SmackAndroid;


public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        SmackAndroid.init(this);
    }
}

1 个答案:

答案 0 :(得分:0)

一个简单的谷歌搜索,你会找到答案。

答案是你的jar文件不包含正确的jar文件,它包含你需要的java类。

如果您不使用任何构建工具。那我建议你用它。这样你就可以告诉构建工具包含那个非常重要的jar文件。

像常春藤,maven,蚂蚁等构建工具。

在IDE中编码时可以使用该类的原因。由于某种原因,IDE是否在其类路径中具有该jar文件/类。但不是在构建路径上。 为什么,很难知道,因为你没有显示你的项目文件或相同的文件。

但我很确定你现在可以解决问题了。