添加 Meta Audience Network 后出现“重复类”错误 - Android

Kar*_*ouh 1 dependencies android facebook ads android-studio

每当我在添加元依赖项后尝试构建我的应用程序时,都会收到此错误消息:在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 中找到重复的类 android.support.v4.app.INotificationSideChannel 和support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 在模块 core-1.9.0-runtime (androidx. core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 在中找到重复的类 android.support.v4.app.INotificationSideChannel$Stub$Proxy模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 重复类 android.support。 v4.os.IResultReceiver 在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 中找到)在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android. support:support-compat:25.2.0) 在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat 中找到重复的类 android.support.v4.os.IResultReceiver$Stub$Proxy -25.2.0-runtime (com.android.support:support-compat:25.2.0) 在模块 core-1.9.0-runtime (androidx.core:core:1.9) 中找到重复的类 android.support.v4.os.ResultReceiver .0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 在 core-1.9.0-runtime 模块中找到重复的类 android.support.v4.os.ResultReceiver$1 (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 找到重复的类 android.support.v4.os.ResultReceiver$MyResultReceiver在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat:25.2.0) 中重复类 android.support .v4.os.ResultReceiver$MyRunnable 在模块 core-1.9.0-runtime (androidx.core:core:1.9.0) 和 support-compat-25.2.0-runtime (com.android.support:support-compat: 25.2.0)

请参阅文档了解如何修复依赖项解析错误。

小智 11

您可以将以下两行添加到 gradle.properties 文件中:

android.useAndroidX=true
android.enableJetifier=true
Run Code Online (Sandbox Code Playgroud)