一、资源包会报如下错误:
错误类似 (androidx.core:core:1.10.0) 和 (com.android.support:support-compat:24.2.0)
表示资源重复,不知调用androidx包下面的,还是v4包下面的
Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$CallbackHandler found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ConnectionCallback found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ConnectionCallback$ConnectionCallbackInternal found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ItemCallback found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ItemReceiver found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImpl found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$2 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21$3 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi23 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$2 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$3 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$MediaServiceConnection found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$MediaServiceConnection$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserImplBase$MediaServiceConnection$2 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaBrowserServiceCallbackImpl found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaItem found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$MediaItem$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$ServiceBinderWrapper found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$Subscription found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaBrowserCompat$SubscriptionCallback found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaDescriptionCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaDescriptionCompat$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaDescriptionCompat$Builder found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaMetadataCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.MediaMetadataCompat$Builder found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.RatingCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.RatingCompat$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.RatingCompat$StarStyle found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.RatingCompat$Style found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.IMediaControllerCallback found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.IMediaControllerCallback$Stub found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.IMediaControllerCallback$Stub$Proxy found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.IMediaSession found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.IMediaSession$Stub found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.IMediaSession$Stub$Proxy found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback$MessageHandler found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$Callback$StubCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImpl found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi21 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$MediaControllerImplBase found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$PlaybackInfo found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$TransportControls found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$TransportControlsApi21 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaControllerCompat$TransportControlsBase found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$Callback found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$MediaSessionImpl found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$MediaSessionImplApi21 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase$Command found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase$MediaSessionStub found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase$MessageHandler found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$OnActiveChangeListener found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$QueueItem found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$QueueItem$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$ResultReceiverWrapper found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$ResultReceiverWrapper$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$Token found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.MediaSessionCompat$Token$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.ParcelableVolumeInfo found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.ParcelableVolumeInfo$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$Actions found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$Builder found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$CustomAction found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$CustomAction$1 found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$CustomAction$Builder found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$MediaKeyAction found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.media.session.PlaybackStateCompat$State found in modules media-1.2.1-runtime (androidx.media:media:1.2.1) and support-media-compat-24.2.0-runtime (com.android.support:support-media-compat:24.2.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.10.0-runtime (androidx.core:core:1.10.0) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
二、 解决方法
2.1 在gradle.properties中只添加了android.useAndroidX=true(表示当前项目启用 AndroidX)
2.2 添加android.enableJetifier=true(表示将依赖包也迁移到AndroidX,将项目中用到的第三方库中的support引用转为androidx引用) 即可
android.useAndroidX=true
android.enableJetifier=true