Hyperion-Android
Hyperion-Android copied to clipboard
Duplicate class autoservice
I encounter this problem when run my app with dependencies hyperion: Duplicate class com.google.auto.service.AutoService found in modules auto-service-1.0-rc2.jar (com.google.auto.service:auto-service:1.0-rc2) and classes.jar (com.willowtreeapps.hyperion:hyperion-plugin:0.9.27)
Tell the truth, it is not a good idea put a third-party class into into your libs
Tell the truth, it is not a good idea put a third-party class into into your libs
This isn't a very helpful comment to make and it's a generalization.
Duplicate class com.google.auto.service.AutoService found in modules auto-service-1.0-rc2.jar (com.google.auto.service:auto-service:1.0-rc2) and classes.jar (com.willowtreeapps.hyperion:hyperion-plugin:0.9.27)
This is a bit perplexing as hyperion-plugin
does not depend on auto-value. Furthermore, 0.9.27 of the Hyperion uses rc4
of auto-service
, not rc2
. You can verify that hyperion-plugin
does not depend on auto-value here:
https://repo1.maven.org/maven2/com/willowtreeapps/hyperion/hyperion-plugin/0.9.27/hyperion-plugin-0.9.27.pom
And here is an example of a plugin which does depend on it.. or at least it should be. https://repo1.maven.org/maven2/com/willowtreeapps/hyperion/hyperion-timber/0.9.27/hyperion-timber-0.9.27.pom
Looking at the plugin POM file and noting the dependency is missing leads me to think that the annotation processor is doing something incorrectly. It appears that the auto value dependency should be compileOnly
which would correctly exclude it from the generated POM however the dependency is also clearly at least partially included in the exported JAR/AAR it seems. Either way you can use dependency exclusion to fix it on the consumer side:
https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:excluding_transitive_module_dependencies
Sorry for not describing the question clearly.
Hyperion need and should depends on auto-service, but should not directly put auto-service classes(com.google.auto.service.AutoService
) in the hyperion-plugins packages like this
import auto-service in the build.gradle
implementation deps.auto_service
annotationProcessor deps.auto_service
Otherwise I import auto-service by myself, it will conflict and caused the question as I reported. Now I haved imported hyperion-android source code in my app , and replace the auto-service import methods mentioned above. It works Okay.
Any update on this one? @jonyChina162 how did you solve this?
facing the same issue. any update ?
I'm using com.google.firebase:firebase-ml-modeldownloader-ktx
which depends on auto.service then my project wont run..
I guess I have to remove hyperion for now..
I was blocked by this when trying to integrate Hyperion into a project with moshi-kotlin-codegen
which also uses AutoService.
I figured one other, slightly dirty solution would be to use Jar Jar Links Gradle plugin to remove AutoService
class from hyperion-plugin
and repackage it. But it seems that the plugin doesn't work on newer (7.0+) versions of Gradle, so we're back to square one.
Is there anything blocking Hyperion from directly depending on auto-service-annotations
instead of declaring the class manually?