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?

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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.<init> It seems that javax.xml.stream.* was included in that excluded libraries... now I have no idea what to do to make it work.
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.