在我的项目中,我使用
androidx.security:security-crypto-ktx
库来实现 EncryptedSharedPreference。现在我必须使用com.google.crypto.tink:apps-paymentmethodtoken
库。
当我尝试同时使用它们时,tink-android 模块内的所有文件都会出现此错误。
原因:java.lang.RuntimeException:在模块 jetified-tink-1.8.0 (com.google.crypto.tink:tink:1.8.0) 和 jetified-tink 中发现重复的类 com.google.crypto.tink.AccessesPartialKey -android-1.8.0 (com.google.crypto.tink:tink-android:1.8.0)
我已尝试将这两个库更新到最新版本,但问题仍然存在。 我也尝试过像这样从库中排除该模块
排除(组=“com.google.crypto.tink”,模块=“tink-android”)
但是当我使用 androidx-security 库执行此操作时,我会在 EncryptedSharedPreference 的文件中遇到类未找到异常。
还有其他人遇到过类似的问题吗?或者知道如何解决这个问题?
尝试使用
exclude(group = "com.google.crypto.tink", module = "tink")