I'm using Dagger in a Java library module in an Android Studio project and here's what my build.gradle
for the module looks like:
apply plugin: 'java-library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.dagger:dagger:2.24'
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
}
sourceCompatibility = "7"
targetCompatibility = "7"
I can see that the Dagger is properly generating implementations and they are present in build/generated/sources/annotationProcessor
but for some reason I cannot access them in the code. Also, the generated files shows an error at the package
statement that states:
Package name "com.example.javamodule" does not correspond to the file path "java.main.com.example.javamodule"
I have two questions here. First, how can I access the Dagger generated classes in my java module code and second, how to remove the above-mentioned error from the generated classes?