Search code examples
androidgradleandroid-lintolingo

android lint - InvalidPackage errors when using apache odata-client-android


I want to use the apache olingo odata library in an android project. Since apache offers a specific build for android, i put this one as a dependency to my build.gradle file.

compile 'org.apache.olingo:odata-client-android:4.0.0'

When building the application, i run into multiple InvalidPackage lint errors:

As an example:

InvalidPackage: Package not included in Android
 odata-client-android-4.0.0.jar: Invalid package reference in library; 
 not included in Android: javax.activation. Referenced from
 com.fasterxml.jackson.module.jaxb.deser.DataHandlerJsonDeserializer.

There are also InvalidPackage errors for the javax.xml.bind package

As a Solution, it is suggested to add the following rule to build.gradle:

android {
    lintOptions {
        abortOnError false
    }
}

So my questions are :

  • Is it safe to add this rule? How can i be sure that this wont result in some runtime errors later.
  • Since the artifact is dedidacted for android, shouldn´t such errors be fixed there? Or am i missing something else.

Thanks in advance for any help


Solution

  • The InvalidPackage lint check flags packages that are not included by default on Android. If you're certain that the javax.activation package is not used on Android either because they provide a separate code path for using it, you can disable the check.

    lintOptions {
      disable 'InvalidPackage',...
    }
    

    To get more information about the actual error you can use lint --show InvalidPackage