Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.5.0-runtime

冲突问题

androidx和support类冲突,具体如下:

Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-27.1.1-runtime (com.android.support:support-compat:27.1.1)

Go to the documentation to learn how to Fix dependency resolution errors.

解决办法

在工程中 gradle.properties 中加入配置:android.enableJetifier=true

Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.5.0-runtime_第1张图片

说明

其实在出错的同时也有这么断错误:

AGPBI: {“kind”:“warning”,“text”:“Your project has set android.useAndroidX=true, but configuration :player:debugRuntimeClasspath still contains legacy support libraries, which may cause runtime issues.\nThis behavior will not be allowed in Android Gradle plugin 8.0.\nPlease use only AndroidX dependencies or set android.enableJetifier=true in the gradle.properties file to migrate your project to AndroidX (see https://developer.android.com/jetpack/androidx/migrate for more info).\nThe following legacy support libraries are detected:\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.github.bumptech.glide:gifdecoder:4.9.0 -> com.android.support:support-annotations:27.1.1\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> com.android.support:support-compat:27.1.1\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> com.android.support:support-compat:27.1.1 -> android.arch.lifecycle:runtime:1.1.0\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> android.arch.lifecycle:livedata-core:1.1.0 -> android.arch.lifecycle:common:1.1.0\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> android.arch.lifecycle:livedata-core:1.1.0 -> android.arch.core:common:1.1.0\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> com.android.support:support-core-ui:27.1.1\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> com.android.support:support-core-utils:27.1.1\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> android.arch.lifecycle:livedata-core:1.1.0\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> android.arch.lifecycle:livedata-core:1.1.0 -> android.arch.core:runtime:1.1.0\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:support-fragment:27.1.1 -> android.arch.lifecycle:viewmodel:1.1.0\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:animated-vector-drawable:27.1.1\n:player:debugRuntimeClasspath -> project :listplayer -> com.github.bumptech.glide:glide:4.9.0 -> com.android.support:animated-vector-drawable:27.1.1 -> com.android.support:support-vector-drawable:27.1.1”,“sources”:[{}]}

Your project has set android.useAndroidX=true, but configuration :player:debugRuntimeClasspath still contains legacy support libraries, which may cause runtime issues.
This behavior will not be allowed in Android Gradle plugin 8.0.
Please use only AndroidX dependencies or set android.enableJetifier=true in the gradle.properties file to migrate your project to AndroidX (see https://developer.android.com/jetpack/androidx/migrate for more info).
The following legacy support libraries are detected:

工具已经提示我们怎么处理了。工程已经配置了androidx,但又配置了support 的库,运行的时候可能会发生错误。请仅使用androidx的依赖或者在gradle.properties中添加android.enableJetifier=true将support库转换为androidx的依赖。

其次,个人在使用过程中,遇见了1.5 / 1.7的冲突,只有INotificationSideChannel和os.ResultReceiver两个类冲突。若不是可以配置android.enableJetifier=true将其转换,各种依赖查询,各种exclude要死人的。

你可能感兴趣的:(android,android,studio,移动开发,androidx冲突)