Android和QUOT; java.lang.NoClassDefFoundError的"例外 [英] Android "java.lang.noclassdeffounderror" exception

查看:105
本文介绍了Android和QUOT; java.lang.NoClassDefFoundError的"例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个web服务的Andr​​oid客户端应用程序。我试图用Java标准WS库支持。我已剥离的应用降到最小,如下面所示,为了尝试和隔离问题。下面是应用

I have a android webservice client application. I am trying to use the java standard WS library support. I have stripped the application down to the minimum, as shown below, to try and isolate the issue. Below is the application,

package fau.edu.cse;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class ClassMap extends Activity {

    TextView displayObject;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        // Build Screen Display String
        String screenString = "Program Started\n\n";

        // Set up the display
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        displayObject = (TextView)findViewById(R.id.TextView01);

        screenString = screenString + "Inflate Disaplay\n\n";

        try {
        // Set up Soap Service
        TempConvertSoap service = new TempConvert().getTempConvertSoap();

        // Successful Soap Object Build
        screenString = screenString + "SOAP Object Correctly Build\n\n";

        // Display Response
        displayObject.setText(screenString);
        }
        catch(Throwable e){
    e.printStackTrace();
    displayObject.setText(screenString +"Try Error...\n" + e.toString());
        }
    }
}

中的类tempConvert和tempConvertSoap是在包fau.edu.cse。我已经包含在Java构建pasth通过Java SE的javax库。当Android的应用程序试图创建服务的对象,我得到一个java.lang.NoClassDefFoundError的异常。这两个类tempConvertSoap和TempConvet()的wsimport生成。我也使用几个库从javax.jws中..和javax.xml.ws。当然应用程序编译没有错误和正确加载。我知道,在应用程序运行becouse我的try / catch例行成功捕获错误并打印出来。下面是在logcat中说,(注意,它不能找到TempConvert)

The classes tempConvert and tempConvertSoap are in the package fau.edu.cse. I have included the java SE javax libraries in the java build pasth. When the android application tries to create the "service" object I get a "java.lang.noclassdeffounderror" exception. The two classes tempConvertSoap and TempConvet() are generated by wsimport. I am also using several libraries from javax.jws.. and javax.xml.ws.. Of course the application compiles without error and loads correctly. I know the application is running becouse my "try/catch" routine is successfully catching the error and printing it out. Here is what is in the logcat says (notice that it cannot find TempConvert),

06-12 22:58:39.340: WARN/dalvikvm(200): Unable to resolve superclass of Lfau/edu/cse/TempConvert; (53)
06-12 22:58:39.340: WARN/dalvikvm(200): Link of class 'Lfau/edu/cse/TempConvert;' failed
06-12 22:58:39.340: ERROR/dalvikvm(200): Could not find class 'fau.edu.cse.TempConvert', referenced from method fau.edu.cse.ClassMap.onCreate
06-12 22:58:39.340: WARN/dalvikvm(200): VFY: unable to resolve new-instance 21 (Lfau/edu/cse/TempConvert;) in Lfau/edu/cse/ClassMap;
06-12 22:58:39.340: DEBUG/dalvikvm(200): VFY: replacing opcode 0x22 at 0x0027
06-12 22:58:39.340: DEBUG/dalvikvm(200): Making a copy of Lfau/edu/cse/ClassMap;.onCreate code (252 bytes)
06-12 22:58:39.490: DEBUG/dalvikvm(30): GC freed 2 objects / 48 bytes in 273ms
06-12 22:58:39.530: DEBUG/ddm-heap(119): Got feature list request
06-12 22:58:39.620: WARN/Resources(200): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f050000}
06-12 22:58:39.620: WARN/System.err(200): java.lang.NoClassDefFoundError: fau.edu.cse.TempConvert
06-12 22:58:39.830: WARN/System.err(200):     at fau.edu.cse.ClassMap.onCreate(ClassMap.java:26)
06-12 22:58:39.830: WARN/System.err(200):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-12 22:58:39.830: WARN/System.err(200):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
06-12 22:58:39.830: WARN/System.err(200):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
06-12 22:58:39.830: WARN/System.err(200):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
06-12 22:58:39.880: WARN/System.err(200):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
06-12 22:58:39.880: WARN/System.err(200):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-12 22:58:39.880: WARN/System.err(200):     at android.os.Looper.loop(Looper.java:123)
06-12 22:58:39.880: WARN/System.err(200):     at android.app.ActivityThread.main(ActivityThread.java:4363)
06-12 22:58:39.880: WARN/System.err(200):     at java.lang.reflect.Method.invokeNative(Native Method)
06-12 22:58:39.880: WARN/System.err(200):     at java.lang.reflect.Method.invoke(Method.java:521)
06-12 22:58:39.880: WARN/System.err(200):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-12 22:58:39.880: WARN/System.err(200):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-12 22:58:39.880: WARN/System.err(200):     at dalvik.system.NativeStart.main(Native Method)

... ... BLA BLA BLA ...

...bla...bla...bla

这将是巨大的,如果有人只是有了答案,但是我在看调试策略。我采取这种相同的应用程序并创建了一个标准的Java客户端应用程序,它工作正常 - 与所有取出的Andr​​oid的东西,当然。这将是一个很好的调试策略?你会推荐什么样的方法和技术,我试着找出问题?我在想,有某种Dalvik虚拟机不兼容导致该TempConvert类不加载的。 TempConvert是一个接口类,引用了很多非常棘手的web服务属性。与调试策略的任何帮助将是非常乐意AP preciated。

It would be great if someone just had an answer, however I am looking at debug strategies. I have taken this same application and created a standard java client application and it works fine -- of course with all of the android stuff taken out. What would be a good debug strategy? What methods and techniques would you recommend I try and isolate the problem? I am thinking that there is some sort of Dalvik VM incompatibility that is causing the TempConvert class not to load. TempConvert is an interface class that references a lot of very tricky webservice attributes. Any help with debug strategies would be gladly appreciated.

感谢您的帮助,
史蒂夫

Thanks for the help, Steve

推荐答案

下面是你的问题:

java.lang.NoClassDefFoundError: fau.edu.cse.TempConvert

从的javadoc:

From the javadocs:

如果抛出该异常的Java虚拟机或
  ClassLoader实例尝试加载
  在类的定义(如部分
  正常的方法调用或作为其一部分
  创建使用新的一个新的实例
  前pression),并没有定义
  类可以被发现。

Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

的搜索的类定义
  当当前执行的存在
  类被编译,但定义
  不再能够找到。

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.

听起来像是你有一个Android部署或包装问题。它无法找到你的班级,尽管你的假设。

Sounds like you have an Android deployment or packaging issue. It can't find your class, despite your assumptions.

当你观察到的行为反驳你的假设,你应该把它们放到一边,检查一切从头开始。假设一切是正确的,尽管你在你的眼前有证据,获取找到解决办法的途径。

When you observe behavior that counters your assumptions, you should put them aside and check everything from the beginning. Assuming that everything is correct, in spite of the evidence you have before your eyes, gets in the way of finding a solution.

这篇关于Android和QUOT; java.lang.NoClassDefFoundError的"例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆