GPGVM
GPGVM

Reputation: 5619

XStream NoClassDefFoundError

I've been beating my head against the wall most of the day on this one. I added the xstream-1.4.2 to java build path and call it from my code no problems:

XStream yyz = new XStream();
String str_xml = yyz.toXML(ld_data);

Everything compiles but when the execution reaches the first line above (XStream instantiation) I get the error seen in the stack trace below. The error seems to me to indicate that it can't find the XStream object yet it does as intellisense and compilation are gtg. The steps I used in Eclipse to add the external file are:

right click project > Build Path > Configure Build Path.

On the left Java Build Path on the right select the Libraries tab.

On the right click the Add External jar's and then browsed to XStream file and added it. Hit OK and ran smack into the error??

FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.thoughtworks.xstream.XStream at org.gpgvm.ironmike.IcyArmActivity.onOptionsItemSelected (IcyArmActivity.java:166) at android.app.Activity.onMenuItemSelected(Activity.java:2205) at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected (PhoneWindow.java:748) at com.android.internal.view.menu.MenuItemImpl.invoke (MenuItemImpl.java:143) at com.android.internal.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:855) at com.android.internal.view.menu.IconMenuView.invokeItem (IconMenuView.java:532) at com.android.internal.view.menu.IconMenuItemView.performClick (IconMenuItemView.java:122) at android.view.View$PerformClick.run(View.java:9080) at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3683) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method)


Caused by: java.lang.ClassNotFoundException: com.thoughtworks.xstream.XStream


in loader dalvik.system.PathClassLoader[/data/app/org.gpgvm.ironmike-2.apk] at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) at java.lang.ClassLoader.loadClass(ClassLoader.java:551) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) ... 17 more

Any ideas as to what I'm missing? JB

Upvotes: 3

Views: 9025

Answers (1)

GPGVM
GPGVM

Reputation: 5619

Found the answer here. There is alot of partial and bad information out there but this post is complete.

Adding a library/JAR to an Eclipse Android project

Upvotes: 3

Related Questions