I'm trying to deserialize an object on an Android device using SimpleXML. In a maven file I used dependency with exclusions (I followed an advice in an another question, as without excluding these dependencies, I couldn't start the application):
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.6.7</version>
<exclusions>
<!-- StAX is not available on Android -->
<exclusion>
<artifactId>stax</artifactId>
<groupId>stax</groupId>
</exclusion>
<exclusion>
<artifactId>stax-api</artifactId>
<groupId>stax</groupId>
</exclusion>
<!-- Provided by Android -->
<exclusion>
<artifactId>xpp3</artifactId>
<groupId>xpp3</groupId>
</exclusion>
</exclusions>
For testing I wrote just a simple class:
class Test {
String s;
}
and I try to get an object:
Test t = null;
try {
t = serializer.read(Test.class, source);
} catch (Exception e) {
e.printStackTrace();
}
Log.v("t",t.s);
but in the last line, while I try to read the field t.s, I'm getting errors like:
Could not find method javax.xml.stream.XMLInputFactory.newInstance, referenced from method org.simpleframework.xml.stream.StreamProvider.<init>
unable to resolve static method 3372: Ljavax/xml/stream/XMLInputFactory;.newInstance ()Ljavax/xml/stream/XMLInputFactory;
dead code 0x0006-0009 in Lorg/simpleframework/xml/stream/StreamProvider;.<init>
unable to find class referenced in signature (Ljavax/xml/stream/XMLEventReader;)
What can be the cause of the problem and how can I solve it?