AnnotationProcessor dependency for Gradle using a jar file

913 views Asked by At

I am integrating dagger in my project and I am having this issue.

I want to add jar dependencies instead of

`annotationProcessor "com.google.dagger:dagger-compiler:2.41"`

like below

annotationProcessor files('libs/dagger-compiler-2.41.jar') but when I compile, it gives me error

Execution failed for task ''.

dagger/spi/shaded/androidx/room/compiler/processing/javac/JavacBasicAnnotationProcessor Caused by: java.lang.NoClassDefFoundError: dagger/spi/shaded/androidx/room/compiler/processing/javac/JavacBasicAnnotationProcesso

It is working with other jar daggger dependency but not with AnnotationProcessor. When I use annotationProcessor "com.google.dagger:dagger-compiler:2.41" everything works fine.

implementation files('libs/javax.inject-1.jar')
implementation files('libs/dagger-2.41.jar')
implementation files('libs/dagger-producers-2.41.jar')
1

There are 1 answers

0
NiJ On

After so much of research and hit and trial and lot of trying I was able to integrate daggger to my Project in gradle as well as in android MK.

For Gradle : Worked for both API 28 and 30

//Dagger Dependencies
annotationProcessor files('libs/dagger-compiler-2.42.jar')
implementation files('libs/dagger-2.42.jar')
annotationProcessor files('libs/dagger-2.42.jar')
annotationProcessor files('libs/jsr305-3.0.2.jar')
annotationProcessor files('libs/dagger-producers-2.42.jar')
annotationProcessor files('libs/dagger-spi-2.42.jar')
annotationProcessor files('libs/google-java-format-1.5.jar')
annotationProcessor files('libs/failureaccess-1.0.1.jar')
annotationProcessor files('libs/guava-31.0.1-jre.jar')
annotationProcessor files('libs/javapoet-1.13.0.jar')
implementation files('libs/javax.inject-1.jar')
annotationProcessor files('libs/javax.inject-1.jar')
annotationProcessor files('libs/incap-0.2.jar')
annotationProcessor files('libs/checker-compat-qual-2.5.5.jar')
annotationProcessor files('libs/kotlin-stdlib-1.6.10.jar')
annotationProcessor files('libs/kotlin-stdlib-jdk8-1.5.32.jar')
annotationProcessor files('libs/kotlinx-metadata-jvm-0.4.2.jar')