According to the 2.4.0 update of Retrofit:
New: Converter for JAXB replaces the now-deprecated converter for Simple XML Framework.
I haven't found a single tutorial on how to implement this to replace my simple xml annotated pojos.
Can anyone share a quick guide on how to transition from simplexml to jaxb?
I have been googling for this today, and eventually ended up on the retrofit JAXB Github page, where they politely tell us that JAXB does not work on Android:
Note that JAXB does not work on Android.
Then I found this answer, where they provide a workaround for this problem.
Please note that I have not tested this myself as I am in a similar situation as you. Trying to figure it all out when I stumbled upon your question. Hope this helps! :)
You can add like this
Add the dependency in the app-level Gradle.
implementation 'com.squareup.retrofit2:retrofit:2.7.2' (Latest version)
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BuildConfig.BASE_URL)
.addConverterFactory(JaxbConverterFactory.create())
.client(httpClient.build())
.build();
But this will not work with your existing SimpleXmlFactory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With