提问人:Dev JD 提问时间:7/5/2019 更新时间:7/5/2019 访问量:360
由于“TransformException: java.util.zip.ZipException...”而生成失败
Build fail because of "TransformException: java.util.zip.ZipException..."
问:
我搜索了很多,但其他问题都没有回答我的问题。 问题是我在构建项目时出现错误
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
所以我已经尝试过的解决方案:
在 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
我不明白我错过了什么!
答: 暂无答案
评论
com.android.support:multidex:1.0.1
androidx.multidex:multidex:2.0.1
compile 'com.android.support:support-v4:23.0.0'
androidx
support-v4
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat
ContextCompat