0

I am taking the input from the web, which is an Xml file and converting into a Json data using the library json-lib . I have created a user library and added the following jars into it:-

  1. json-lib-2.3-jdk15.jar
  2. commons-collections.jar
  3. commons-lang.jar
  4. commons-logging.jar
  5. commons-beanutils.jar
  6. ezmorph-1.0.6.jar
  7. xom-1.1.jar

But still gives the following error:-

08-04 13:58:31.642: ERROR/dalvikvm(484): Could not find class 'net.sf.json.xml.XMLSerializer$CustomElement', referenced from method net.sf.json.xml.XMLSerializer.addNameSpaceToElement

Can anyone help me out in resolving this issue.

Bie
  • 1
  • 1

2 Answers2

0

Since android already support json org.json a different json library may conflict. (You can download the jar here)

Try to use this library instead of an external library on android.

BTW: You can also use this library if you need on any java code (not only android)

Meir Gerenstadt
  • 3,573
  • 1
  • 23
  • 22
0

Either you have a sdk level / jdk level conflict. I mean dalvik can't get the byte code of the CustomElement class of your librairy as it is compiled with to recent features for your SDK like annotations for instance.

Or there is a conflicting librairy json-lib in some other of your jars or lib folders.

(the 3 first comments are not relevant, it's just the way inner classes are compiled, using a $)

Regards, Stéphane

Snicolas
  • 37,840
  • 15
  • 114
  • 173
  • Ya i think so i had conflict jars,but it still gives the following error:- 08-04 15:05:14.303: ERROR/AndroidRuntime(366): FATAL EXCEPTION: main 08-04 15:05:14.303: ERROR/AndroidRuntime(366): java.lang.NoClassDefFoundError: org.apache.commons.io.IOUtils How to resolve this? – Bie Aug 04 '11 at 09:41
  • Are you sure you librairies are compatible with Dalvik ? – Snicolas Aug 05 '11 at 09:59