1

I'm developing an Android application and I'm trying to add a dependency to my pom.xml file:

    <dependency>
        <groupId>org.simpleframework</groupId>
        <artifactId>simple-xml</artifactId>
        <version>2.6.7</version>
    </dependency>

I'm not even using it anywhere, but after I add that dependency, when I try to run the application, I get an error:

 Conversion to Dalvik format failed with error 1


 Ill-advised or mistaken usage of a core class (java.* or javax.*)
 when not building a core library.

Why can't I run it?

krajol
  • 818
  • 3
  • 13
  • 34

2 Answers2

2

Try excluding both stax, stax-api and xpp3 from the simple import as explained here: Android: error including/repacking dependencies which reference javax core classes

Community
  • 1
  • 1
Thomas
  • 2,751
  • 5
  • 31
  • 52
  • 1
    Well, actually now when I try to use this library, I'm getting errors like: 11-12 19:15:16.636: I/dalvikvm(846): Could not find method javax.xml.stream.XMLInputFactory.newInstance, referenced from method org.simpleframework.xml.stream.StreamProvider. It seems that javax.xml.stream.* was included in that excluded libraries... now I have no idea what to do to make it work. – krajol Nov 12 '12 at 18:47
0

Dalvik/Android does not allow using javax.* packages. You have to either shade all of them e.g. with the Maven Shade Plugin or better use a dependency that does not do that.

There might be an android specific version of the simple-xml library available. If you need it for soap webservices you might want to take a look at ksoap2-android instead.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123