Bie
Bie

Reputation: 1

No class found exception while using json-lib in android

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.

Upvotes: 0

Views: 1455

Answers (2)

Meir Gerenstadt
Meir Gerenstadt

Reputation: 3593

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)

Upvotes: 0

Snicolas
Snicolas

Reputation: 38168

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

Upvotes: 0

Related Questions