Using Jaxb with Google Android

Using JAXB with Google Android

I'm not exactly resolving your problem, but JAXB isn't included in android by default and the library will cost you 9(!) MB of your apk. Try SimpleXML instead. It has similiar abilities and much more lightweight.

Standard equivalent for JAXB in Android

Is there any SDK component that I can use to transform the XSD schema files to Java classes

No.

I am stuck with using XmlSerializer/XMLPullParser?

You are welcome to use DOM or SAX instead of XmlPullParser, just as you can in classic Java.

There are also several XML parsing libraries for Android, beyond just SimpleXML.

Is there a need in JAXB implementation for Android?

As an Android developer who does lot of XML and JSON parsing and framing in almost every app I develop, my answer would be: No, there is no need for JAXB on Android. The other tools fit the bill perfectly. Either that, or we Android developers have got used to the absence of JAXB and each of us have gotten comfortable with one of the alternatives.

In my case, I even achieve code reuse by replacing JAXB with my favorite Android XML serialization library on the server as well.

Where to put JAXB dependency for compiling Android Databinding on Java 11?

UPDATE As of 2020-07-21, the Android bug tracker now states:

Studio will also start using JDK 11 starting in 4.2, approx in 1 to 2 months.


According to a member of the Android Project on the Android Bug Tracker as of 2019-03-07:

Java 11 is not supported by Android studio and its tools.

Create Android app using API that reference JAXBContext

Try JiBX (http://jibx.sourceforge.net/), it's a small and fast footprint, Android compatible, XML binding framework.

Is it possible to use both JAXB and Simple XML?

The only solution I see as possible is using both annotation types at the same time. You can mark each member field with JAXB and SimpleXML annotations. Of course you need some glue to get this working and make the compiler not complain about inexistent annotations. To get rid of this you can write your own annotation library implementing the missing annotations in every case (JAXB annotations on Android and SimpleXML on other projects) doing what is expected (nothing).



Related Topics



Leave a reply



Submit