先看看网上的方法是怎么样的:
implementation ('com.android.support:support-fragment:28.0.0'){
exclude group: "com.android.support",module: 'versionedparcelable'
}
是我盲区,上述对我无效,没能解决,当场哭了
我们来看看 错误日志 长啥样
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.core.graphics.drawable.IconCompatParcelizer found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.core.internal.package-info found in modules core-1.1.0-runtime.jar (androidx.core:core:1.1.0) and support-compat-28.0.0-runtime.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.versionedparcelable.CustomVersionedParcelable found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.NonParcelField found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelField found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl$1 found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelUtils found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$1 found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$ParcelException found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelParcel found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream$FieldBuffer found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelable found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelize found in modules versionedparcelable-1.1.0-runtime.jar (androidx.versionedparcelable:versionedparcelable:1.1.0) and versionedparcelable-28.0.0-runtime.jar (com.android.support:versionedparcelable:28.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
解决
其实出现这种最多就是引入的依赖中包含重复的类,只需要在两个或多个依赖中移除其他的,只保留其中一个就可以。


这篇博客讨论了Android开发中遇到的依赖冲突问题,特别是Duplicate Class错误。错误日志显示多个库中存在重复的类,如android.support.v4包下的多个类。解决方法是通过排除特定模块,例如使用`exclude group`来避免冲突。博客提醒开发者检查并调整Gradle配置,以确保只保留必要的依赖,从而解决冲突。
5653

被折叠的 条评论
为什么被折叠?



