tink-crypto / tink

Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.
https://developers.google.com/tink
Apache License 2.0
13.47k stars 1.18k forks source link

Duplicate class found in modules jetified-tink-1.8.0 and jetified-tink-android-1.8.0 #731

Closed shubhpilot closed 5 months ago

shubhpilot commented 5 months ago

Hello, on my Kotlin Project, I am using androidx.security:security-crypto-ktx library for EncryptedSharedPreference. Now I have to use com.google.crypto.tink:apps-paymentmethodtoken library.

When I am trying to use these both together, I am getting this error for all the files inside tink-android module.

Caused by: java.lang.RuntimeException: Duplicate class com.google.crypto.tink.AccessesPartialKey found in modules jetified-tink-1.8.0 (com.google.crypto.tink:tink:1.8.0) and jetified-tink-android-1.8.0 (com.google.crypto.tink:tink-android:1.8.0)

I have tried updating both the libraries to their latest version but the issue still persists.

I have also tried excluding the module from the library like this

exclude(group = "com.google.crypto.tink", module = "tink-android")

but when I do this with androidx-security library then I get class not found exception with EncryptedSharedPreference's file. And excluding with tink:apps-paymentmethodtoken library doesn't work either.

Any idea how can I resolve this? I have to use both the libraries.

shubhpilot commented 5 months ago

Resolved. I had to use exclude(group = "com.google.crypto.tink", module = "tink") with tink library.