Android "java.lang.noclassdeffounderror" exception

Posted by wpbnewbie on Stack Overflow See other posts from Stack Overflow or by wpbnewbie
Published on 2010-06-13T00:14:01Z Indexed on 2010/06/13 0:22 UTC
Read the original article Hit count: 1303

Filed under:
|

Hello,

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 applicaiton,

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());
    }
}

}

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

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

© Stack Overflow or respective owner

Related posts about android

Related posts about webservices