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

Move gson to External Dependency Manager #523

Closed
oddgames-david opened this issue Jan 19, 2022 · 1 comment · Fixed by #653
Closed

Move gson to External Dependency Manager #523

oddgames-david opened this issue Jan 19, 2022 · 1 comment · Fixed by #653

Comments

@oddgames-david
Copy link

  • What went wrong:
    Execution failed for task ':launcher:checkDebugDuplicateClasses'.

1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.google.gson.DefaultDateTypeAdapter found in modules jetified-gson-2.8.5.jar (gson-2.8.5.jar) and jetified-gson-2.8.6.jar (com.google.code.gson:gson:2.8.6)
Duplicate class com.google.gson.ExclusionStrategy found in modules jetified-gson-2.8.5.jar (gson-2.8.5.jar) and jetified-gson-2.8.6.jar (com.google.code.gson:gson:2.8.6)
Duplicate class com.google.gson.FieldAttributes found in modules jetified-gson-2.8.5.jar (gson-2.8.5.jar) and jetified-gson-2.8.6.jar (com.google.code.gson:gson:2.8.6)
Duplicate class com.google.gson.FieldNamingPolicy found in modules jetified-gson-2.8.5.jar (gson-2.8.5.jar) and jetified-gson-2.8.6.jar (com.google.code.gson:gson:2.8.6)
Duplicate class com.google.gson.FieldNamingPolicy$1 found in modules jetified-gson-2.8.5.jar (gson-2.8.5.jar) and jetified-gson-2.8.6.jar (com.google.code.gson:gson:2.8.6)

@oddgames-david oddgames-david changed the title Move gson to External Dependency Resolver Move gson to External Dependency Manager Jan 19, 2022
@bruno-garcia
Copy link
Member

bruno-garcia commented Jan 19, 2022

Our latest android sdk (v6.0) doesn't depend on Gson anymore so it'll resolve this issue but it's still in preview. Until we ship a Unity sdk that includes the new android sdk, the work around would be to repack the sentry sdk without the Gson dependency so it picks the one from the other upm package you're using which brings Gson.
Or the other way around, removing Gson from whatever other packages that are bringing it in so the one Sentry packs is used.

Worth noting that Gson 2.8.6 could have issues (google/gson#1597) if you're using Android Gradle Plugin on a version lower than 3.5.3.
Unity documents which version of Gradle it uses, but not of AGP it seems: https://docs.unity3d.com/Manual/android-gradle-overview.html

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

Successfully merging a pull request may close this issue.

2 participants