question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider moving away from JAXB, to be Android friendly

See original GitHub issue

I’m writing an Android app that uses openkeepass. When I read/write a DB, I see:

java.lang.ClassNotFoundException: Didn't find class "javax.xml.bind.JAXB" on path: DexPathList[[zip file "/data/app/tf.tom.myapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/tf.tom.myapplication-1/lib/x86, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    at de.slackspace.openkeepass.xml.KeePassDatabaseXmlParser.toXml(KeePassDatabaseXmlParser.java:18) 
    at de.slackspace.openkeepass.KeePassDatabase.write(KeePassDatabase.java:426) 

The reason is that Android’s javax.xml does provide the entirety of JAXB, nor does Android allow apps to include JARs that are in javax.*

This was news to me, and pretty disappointing.

Consequently, if libraries wish to be Android friendly, they should choose XML libraries other than JAXB, such as Jackson.

Would you be willing to do this? I can provide a PR, when I’m not busy.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
cternescommented, Jul 20, 2016

@vhschlenker I’ve managed to switch to SimpleXML on the new branch ‘feature-simplexml’. Could you help me and try if this works better on Android?

0reactions
cternescommented, Jul 25, 2016

I’ve fixed the issues with the equals tests and merged to master. I think the exclusions should be made in the android project itself as they are purely android related.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using JAXB with Google Android - Stack Overflow
I want to use for these purposes JAXB framework, because I have pre-annotated (using JAXB) java-class.
Read more >
JAXB can be made to run on Android - docx4j
Since docx4j relies heavily on JAXB, the key to getting it working was getting JAXB – the reference implementation – to run on...
Read more >
Top 10 Most Common Mistakes That Android Developers Make
These bugs are easily prevented, as long as we get the basics right! Here's a quick rundown of the 10 most common mistakes...
Read more >
Migrate apps to Android 12 | Android Developers
Quick overview of the steps involved in bringing your app to Android 12.
Read more >
View - Android Developers
If you have already depended on this class, consider copying the implementation from AOSP ... To get a particular view to take focus,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found