Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate class ...MoshiRequestBodyConverter found in modules - version 3.5.0 #105

Open
ralfgehrer opened this issue Jan 28, 2020 · 1 comment

Comments

@ralfgehrer
Copy link

I added moshi-jsonapi to my Android project as follows in the build.gradle:

implementation 'moe.banana:moshi-jsonapi:3.5.0'
implementation 'moe.banana:moshi-jsonapi-retrofit-converter:3.5.0'

As I'm using Retrofit in my project, I also added the converter. Unfortunately, there are now three Duplicate classes, that seem to be packaged in both modules. Stack trace below:

* What went wrong:
Execution failed for task ':app:checkDevDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class moe.banana.jsonapi2.JsonApiConverterFactory found in modules moshi-jsonapi-retrofit-converter-3.5.0.jar (moe.banana:moshi-jsonapi-retrofit-converter:3.5.0) and retrofit-converter-3.5.0.jar (moe.banana.moshi-jsonapi:retrofit-converter:3.5.0)
  Duplicate class moe.banana.jsonapi2.JsonApiConverterFactory$MoshiRequestBodyConverter found in modules moshi-jsonapi-retrofit-converter-3.5.0.jar (moe.banana:moshi-jsonapi-retrofit-converter:3.5.0) and retrofit-converter-3.5.0.jar (moe.banana.moshi-jsonapi:retrofit-converter:3.5.0)
  Duplicate class moe.banana.jsonapi2.JsonApiConverterFactory$MoshiResponseBodyConverter found in modules moshi-jsonapi-retrofit-converter-3.5.0.jar (moe.banana:moshi-jsonapi-retrofit-converter:3.5.0) and retrofit-converter-3.5.0.jar (moe.banana.moshi-jsonapi:retrofit-converter:3.5.0)

Any idea how to fix this @kamikat ?

@ralfgehrer
Copy link
Author

My current workaround is as follow:

    implementation 'com.squareup.moshi:moshi:1.4.0'
    implementation ('moe.banana:moshi-jsonapi:3.5.0') {
        exclude group: 'moe.banana.moshi-jsonapi', module: 'retrofit-converter'
    }
    implementation 'moe.banana:moshi-jsonapi-retrofit-converter:3.5.0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant