Android linter error: Invalid package references from com.fasterxml.jackson.module.jaxb

22 views
Skip to first unread message

anu thomas

unread,
Aug 14, 2019, 2:07:20 AM8/14/19
to jackson-user
I'm writing an android application, which has following Jackson dependencies:

implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9'

implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.9'


While building the application using "gradle clean build", the linter reported following errors:

jackson-module-jaxb-annotations-2.9.9.jar: Error: Invalid package reference in library; not included in Android: javax.activation. Referenced from com.fasterxml.jackson.module.jaxb.deser.DataHandlerJsonDeserializer. [InvalidPackage]

jackson-module-jaxb-annotations-2.9.9.jar: Error: Invalid package reference in library; not included in Android: javax.xml.bind.annotation.adapters. Referenced from com.fasterxml.jackson.module.jaxb.AdapterConverter. [InvalidPackage]

jackson-module-jaxb-annotations-2.9.9.jar: Error: Invalid package reference in library; not included in Android: javax.xml.bind.annotation. Referenced from com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector. [InvalidPackage]

It looks like the Jackson module "com.fasterxml.jackson.module.jaxb" is using following packages not available in Android platform:

javax.activation
javax.xml.bind.annotation.adapters
javax.xml.bind.annotation

As per linter documentation - This is only an error if your code calls one of the library classes which wind up referencing the unsupported package.

My understanding is "com.fasterxml.jackson.module.jaxb" module provides support for using JAXB (javax.xml.bind) annotations as an alternative to native Jackson annotations.

If my application is not using any JAXB (javax.xml.bind) annotations and uses only the native Jackson annotations then is it safe to ignore these linter errors (so that I can suppress it)?


Tatu Saloranta

unread,
Aug 23, 2019, 6:08:47 PM8/23/19
to jackson-user
First of all, apologies for slow response.

Yes, I think you are correct that they are safe to ignore. You may
want to try to see if you can exclude dependency to JAXB module
package, but ignoring warnings should be fine.
Jackson core components do not rely on these types.

-+ Tatu +-
Reply all
Reply to author
Forward
0 new messages