Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android TransformException:CoordinatorLayout.class中的ZipException重复条目_Android_Exception_Android Gradle Plugin_Build.gradle - Fatal编程技术网

Android TransformException:CoordinatorLayout.class中的ZipException重复条目

Android TransformException:CoordinatorLayout.class中的ZipException重复条目,android,exception,android-gradle-plugin,build.gradle,Android,Exception,Android Gradle Plugin,Build.gradle,我遇到了一个奇怪的例外,在我向Android项目添加了一些资源后,它突然出现了。应用程序完全停止构建并引发以下异常: Error:Execution failed for task ':app:transformClassesWithJarMergingForEliteDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: andr

我遇到了一个奇怪的例外,在我向Android项目添加了一些资源后,它突然出现了。应用程序完全停止构建并引发以下异常:

Error:Execution failed for task 
':app:transformClassesWithJarMergingForEliteDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout$1.class
我以前也遇到过同样的异常,但使用了不同的类,我立即修复了它,但现在的问题是,我不知道副本在哪里,我找不到任何人,所以有相同的副本异常

我试图从所有其他库中排除
support-v4
,我的项目中也启用了
multidex
,但似乎没有解决问题,所以我想你们中的一些人可能会对这一问题有所了解,以及为什么它会突然发生,而我的
build.gradle
文件中没有任何更改,因为它以前工作得非常好

我的
build.gradle
如下所示:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'realm-android'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 27
        versionName "2.2.4"

        multiDexEnabled true

    }

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

    buildTypes {
        release {
            minifyEnabled false
//            proguardFiles 'proguard.cfg'
        }
    }

    useLibrary 'org.apache.http.legacy'
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/DEPENDENCIES'
    }
}

repositories {
    maven {
        url "https://jitpack.io"
    }
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
}

dependencies {
    compile project(':FORTSDKv1.4.1')
    compile files('libs/nineoldandroids-2.4.0.jar')
    compile files('libs/gcm.jar')
    compile files('libs/httpclient-4.3.4.jar')
    compile files('libs/httpmime-4.2.5.jar')
    compile files('libs/HockeySDK-3.0.2.jar')
    compile project(':library-2.4.1')
    // Required for geotagging
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true
    }
    compile('com.code-troopers.betterpickers:library:3.1.0') {
        exclude group: 'com.nineoldandroids', module: 'library'
    }
    compile 'com.android.support:support-v4:27.0.2'
    compile ('com.android.support:appcompat-v7:27.0.2') {
        exclude module: 'support-v4'
    }
    compile ('com.android.support:cardview-v7:27.0.2')
    {
        exclude group: 'com.android.support', module: 'support-v4'
    }
    compile 'com.android.support:customtabs:27.0.2'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.googlecode.libphonenumber:libphonenumber:5.5'
    compile 'org.parceler:parceler-api:1.1.5'
    compile ('com.google.android.gms:play-services-analytics:11.8.0') {
        exclude group: 'com.android.support', module: 'support-v4'
    }
    compile 'com.google.android.gms:play-services-maps:11.8.0'
    compile 'com.google.android.gms:play-services-auth:11.8.0'
    compile 'com.google.android.gms:play-services-gcm:11.8.0'
    compile 'com.google.android.gms:play-services-analytics:11.8.0'
    compile 'com.google.android.gms:play-services-location:11.8.0'
    compile 'com.github.hackware1993:MagicIndicator:1.5.0'
    compile 'com.roomorama:caldroid:2.3.1'
    compile 'com.google.code.gson:gson:2.8.1'
    compile 'com.leocardz:aelv:1.1@aar'
    compile 'com.flaviofaria:kenburnsview:1.0.7'
    compile('com.jakewharton:butterknife:8.4.0') {
        exclude module: 'support-compat'
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile 'com.pixplicity.easyprefs:library:1.8.1@aar'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.github.jrvansuita:IconHandler:+'
    compile 'com.github.mancj:SlideUp-Android:2.2.5'
    compile 'com.afollestad:sectioned-recyclerview:0.5.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.facebook.stetho:stetho:1.4.1'
    compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
    compile 'com.uphyca:stetho_realm:2.0.0'
    compile 'org.greenrobot:eventbus:3.1.1'
    compile 'com.birbit:android-priority-jobqueue:2.0.1'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
    compile 'com.valdesekamdem.library:md-toast:0.8.0'
    compile 'com.facebook.android:account-kit-sdk:4.+'
    compile 'com.facebook.android:facebook-android-sdk:4.17.0'
    compile 'com.wang.avi:library:2.1.3@aar'
    compile 'com.afollestad.material-dialogs:core:0.9.6.0'
    compile 'com.onesignal:OneSignal:3.6.5'
    compile 'com.kbeanie:image-chooser-library:1.6.0@aar'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.scalified:fab:1.1.3'
    compile 'com.github.traex.expandablelayout:library:1.2.2'
    compile 'com.github.markomilos:paginate:0.5.1'
    compile 'com.wdullaer:materialdatetimepicker:3.3.0'
    compile 'com.github.tamir7.contacts:contacts:1.1.7'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
    compile 'com.github.livechat:chat-window-android:v2.0.0'
    compile 'com.uber.sdk:rides-android:0.6.1'
    compile 'link.fls:swipestack:0.3.0'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    compile 'com.instabug.library:instabug:4.3.3'
    compile 'com.victor:lib:1.0.1'
    compile 'com.shamanland:fonticon:0.1.8'
    compile 'jp.wasabeef:recyclerview-animators:2.2.7'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
    compile 'com.github.vihtarb:tooltip:0.1.9'
    compile 'com.daasuu:CountAnimationTextView:0.1.1'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
    compile('com.android.billingclient:billing:1.0') {
        exclude module: 'support-compat'
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
        // exclusion is not necessary, but generally a good idea.
        exclude group: 'com.google.android', module: 'support-v4'
    }
    apt 'com.jakewharton:butterknife-compiler:8.8.1'
    apt 'org.parceler:parceler:1.1.5'
    compile 'com.google.guava:guava:19.0'
    compile 'org.bouncycastle:bcprov-jdk16:1.46'
}


apply plugin: 'com.google.gms.google-services'

非常感谢您的帮助。谢谢。

我也犯了同样的错误,通过在gradle文件的底部添加这个,我可以让我的项目进行构建

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '27.1.0'
            }
        }
    }
}

有关更多信息,请检查此线程:

这应该是可接受的答案。这几天我一直在谷歌上搜索并尝试几种解决方案,这救了我的命。谢谢