`在 AAR 中添加两个本地包时出现重复类失败`

问题描述 投票:0回答:1

我对 Android 开发有点陌生,如果我在任何地方使用了错误的术语,我很抱歉。 我面临的问题是我添加了两个第三方包,它们在内部使用相同的依赖项。这些软件包用于不同的目的。

错误日志是:

* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.realsil.sdk.core.base.BaseService found in modules jetified-crpblelib-1.7.4-runtime (:crpblelib-1.7.4:) and jetified-libraryDfu8762C_v2.0.4-runtime (:libraryDfu8762C_v2.0.4:)
     Duplicate class com.realsil.sdk.core.bluetooth.connection.BluetoothClient found in modules jetified-crpblelib-1.7.4-runtime (:crpblelib-1.7.4:) and jetified-libraryDfu8762C_v2.0.4-runtime (:libraryDfu8762C_v2.0.4:)
     Duplicate class com.realsil.sdk.core.bluetooth.connection.le.BluetoothGattClient found in modules jetified-crpblelib-1.7.4-runtime (:crpblelib-1.7.4:) and jetified-libraryDfu8762C_v2.0.4-runtime (:libraryDfu8762C_v2.0.4:)
     Duplicate class com.realsil.sdk.core.bluetooth.connection.le.BluetoothGattClient$a found in modules jetified-crpblelib-1.7.4-runtime (:crpblelib-1.7.4:) and jetified-libraryDfu8762C_v2.0.4-runtime (:libraryDfu8762C_v2.0.4:)
     Duplicate class com.realsil.sdk.dfu.DfuService found in modules jetified-crpblelib-1.7.4-runtime (:crpblelib-1.7.4:) and jetified-libraryDfu8762C_v2.0.4-runtime (:libraryDfu8762C_v2.0.4:)
     ...

     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

因为它们是 AAR 包,所以我无法使用

exclude
排除常见依赖项。 (我发现的常见依赖是
https://mvnrepository.com/artifact/com.realsil.sdk/rtk-core/1.0.5
) 请告诉我是否有办法解决这个问题。

android aar third-party-libraries
1个回答
0
投票

你能解决这个问题吗?如果是的话,怎么办?

我在同一个库中遇到了同样的问题,但我还无法解决它,但我在以下位置看到了一些有趣的东西:https://imperceptiblethoughts.com/shadow/

这个插件应该能够重命名包以避免冲突。我正在努力,但效果并不好。如果您有什么补充的话,将会有很大的帮助。

© www.soinside.com 2019 - 2024. All rights reserved.