I've created an Android project using Gradle. I've added a Dagger library:
dependencies {
compile 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'com.squareup.dagger:dagger:1.2.1'
}
After trying to compile the project I get a build failure due to lint exceptions:
InvalidPackage: Package not included in Android
../../../../../../.gradle/caches/modules-2/files-2.1/com.squareup.dagger/dagger-compiler/1.2.1/c8bf6c2fda9b27f4d44a2aa4280df525a1408771/dagger-compiler-1.2.1.jar: Invalid package reference in library; not included in Android: javax.annotation.processing. Referenced from dagger.internal.codegen.GraphAnalysisErrorHandler.
../../../../../../.gradle/caches/modules-2/files-2.1/com.squareup.dagger/dagger-compiler/1.2.1/c8bf6c2fda9b27f4d44a2aa4280df525a1408771/dagger-compiler-1.2.1.jar: Invalid package reference in library; not included in Android: javax.lang.model.type. Referenced from dagger.internal.codegen.GeneratorKeys.
../../../../../../.gradle/caches/modules-2/files-2.1/com.squareup.dagger/dagger-compiler/1.2.1/c8bf6c2fda9b27f4d44a2aa4280df525a1408771/dagger-compiler-1.2.1.jar: Invalid package reference in library; not included in Android: javax.lang.model.util. Referenced from dagger.internal.codegen.GraphAnalysisErrorHandler.
../../../../../../.gradle/caches/modules-2/files-2.1/com.squareup/javawriter/2.3.0/4b290e394ea3109be5c0b7f08ff75de089125122/javawriter-2.3.0.jar: Invalid package reference in library; not included in Android: javax.lang.model.element. Referenced from com.squareup.javawriter.JavaWriter.
So, I have to either fix or make lint ignore Dagger packages. I've setup lint.xml
but I can't figure out a way to ignore:
<issue id="InvalidPackage">
<ignore ...INSERT DECLARATION TO IGNORE DAGGER PACKAGE... />
</issue>
Thanks.
Found the answer here: https://android.googlesource.com/platform/tools/base/+/e6a5b9c7c1bca4da402de442315b5ff1ada819c7
adding in build.gradle in android section, lintOptions solved the issue for me:
android {
...
lintOptions {
disable 'InvalidPackage'
}
}
adding the same ignore statement in lint.xml did not worked for me.