由于“ TransformException:java.util.zip.ZipException ...”,构建失败

时间:2019-07-05 12:41:06

标签: android android-studio android-gradle android-support-library androidx

我搜索了很多东西,但没有其他问题能回答我的问题。 问题是在构建项目时出现错误

Error:Execution failed for task ':transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/app/INotificationSideChannel$Stub$Proxy.class

这是我的build.gradle文件

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile(name: 'GoogleAIDL', ext:'aar')
compile(name: 'GooglePlay', ext:'aar')
compile(name: 'androidx.arch.core.core-runtime-2.0.0', ext:'aar')
compile(name: 'androidx.asynclayoutinflater.asynclayoutinflater-1.0.0', ext:'aar')
compile(name: 'androidx.browser.browser-1.0.0', ext:'aar')
compile(name: 'androidx.coordinatorlayout.coordinatorlayout-1.0.0', ext:'aar')
compile(name: 'androidx.core.core-1.0.0', ext:'aar')
compile(name: 'androidx.cursoradapter.cursoradapter-1.0.0', ext:'aar')
compile(name: 'androidx.customview.customview-1.0.0', ext:'aar')
compile(name: 'androidx.documentfile.documentfile-1.0.0', ext:'aar')
compile(name: 'androidx.drawerlayout.drawerlayout-1.0.0', ext:'aar')
compile(name: 'androidx.fragment.fragment-1.0.0', ext:'aar')
compile(name: 'androidx.interpolator.interpolator-1.0.0', ext:'aar')
compile(name: 'androidx.legacy.legacy-support-core-ui-1.0.0', ext:'aar')
compile(name: 'androidx.legacy.legacy-support-core-utils-1.0.0', ext:'aar')
compile(name: 'androidx.lifecycle.lifecycle-livedata-2.0.0', ext:'aar')
compile(name: 'androidx.lifecycle.lifecycle-livedata-core-2.0.0', ext:'aar')
compile(name: 'androidx.lifecycle.lifecycle-runtime-2.0.0', ext:'aar')
compile(name: 'androidx.lifecycle.lifecycle-viewmodel-2.0.0', ext:'aar')
compile(name: 'androidx.loader.loader-1.0.0', ext:'aar')
compile(name: 'androidx.localbroadcastmanager.localbroadcastmanager-1.0.0', ext:'aar')
compile(name: 'androidx.print.print-1.0.0', ext:'aar')
compile(name: 'androidx.slidingpanelayout.slidingpanelayout-1.0.0', ext:'aar')
compile(name: 'androidx.swiperefreshlayout.swiperefreshlayout-1.0.0', ext:'aar')
compile(name: 'androidx.versionedparcelable.versionedparcelable-1.0.0', ext:'aar')
compile(name: 'androidx.viewpager.viewpager-1.0.0', ext:'aar')
compile(name: 'com.android.support.animated-vector-drawable-27.1.1', ext:'aar')
compile(name: 'com.android.support.appcompat-v7-27.1.1', ext:'aar')
compile(name: 'com.android.support.cardview-v7-27.1.1', ext:'aar')
compile(name: 'com.android.support.support-core-utils-27.1.1', ext:'aar')
compile(name: 'com.android.support.support-media-compat-27.1.1', ext:'aar')
//compile(name: 'com.android.support.support-v4-27.1.1', ext:'aar')
compile(name: 'com.android.support.support-vector-drawable-27.1.1', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-18.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-base-18.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-identifier-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-ads-lite-18.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-base-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-basement-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-gass-18.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-measurement-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-measurement-api-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-measurement-base-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-measurement-impl-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-measurement-sdk-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-measurement-sdk-api-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-stats-17.0.0', ext:'aar')
compile(name: 'com.google.android.gms.play-services-tasks-17.0.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-analytics-17.0.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-analytics-unity-5.5.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-app-unity-5.5.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-common-18.0.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-core-17.0.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-iid-19.0.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-iid-interop-17.0.0', ext:'aar')
compile(name: 'com.google.firebase.firebase-measurement-connector-18.0.0', ext:'aar')
compile(name: 'common', ext:'aar')
compile(name: 'facebook-android-wrapper-7.15.1', ext:'aar')
compile(name: 'facebook-applinks', ext:'aar')
compile(name: 'facebook-common', ext:'aar')
compile(name: 'facebook-core', ext:'aar')
compile(name: 'facebook-login', ext:'aar')
compile(name: 'facebook-marketing', ext:'aar')
compile(name: 'facebook-messenger', ext:'aar')
compile(name: 'facebook-places', ext:'aar')
compile(name: 'facebook-share', ext:'aar')
compile(name: 'installreferrer-1.0', ext:'aar')
compile project(':ChartboostSDK')
compile project(':Firebase')
compile project(':GoogleMobileAdsPlugin')
compile 'com.android.support:support-v4:23.0.0'

我检查了重复的类,结果显示这两个依赖项之间存在冲突。

com.android.support:support-v4-23.0.0
androidx.core.core-1.0.0

Check here

所以我已经尝试过的解决方案:

将此代码添加到build.gradle

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
    all*.exclude group: 'com.android.support', module: 'support-annotations'
}

添加此项目后,我可以成功构建我的项目,但启动时由于错误而崩溃

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat

我不明白我在想什么!

0 个答案:

没有答案