I've written an annotation processor using JavaPoet library and included it as a Java Library module to my project. It compiles and works fine. The problem is - Android Studio inline compiler shows me errors that shouldn't be there.
I have already tried:
Always the same three errors, so I am quite at loss here. I have to mention that this problem occurred once I downgraded JavaPoet version from 1.12.1 to 1.9.0 (Java 7 compability turned out to be crucial for my app version, so higher Java 8 versions are out of question).
My gradle file:
apply plugin: 'java-library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
annotationProcessor 'com.google.auto.service:auto-service:1.0-rc2'
implementation 'com.google.auto.service:auto-service:1.0-rc2'
implementation 'android.arch.persistence.room:runtime:1.1.1'
implementation 'com.squareup:javapoet:1.9.0'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
It's not a deal-breaker, but it's distracting and annoying. Do you have any idea of what may be the reason for such behavior?
While I still don't understand what might be the reason, the errors disappeared, once I included the processor module as a project in my main app module, not as a jar.
Basically, I changed this line:
annotationProcessor files('../migrationprocessor/build/libs/migrationprocessor.jar')
To this line:
annotationProcessor project(':migrationprocessor')