错误:任务':app:transformClassesWithJarMergingForRelease'执行失败。随着发布

时间:2017-10-30 07:28:11

标签: android android-studio

  

当我生成发布版本时,我收到此错误   错误:任务':app:transformClassesWithJarMergingForRelease'执行失败。 > com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / arch / core / internal / SafeIterableMap $ ListIterator.class

   buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.23.0'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.hatchapps.multimedia"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 17
        multiDexEnabled = true
        versionName "1.0"
//        aaptOptions.cruncherEnabled = false
//        aaptOptions.useNewCruncher = false
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
//            minifyEnabled false
            multiDexEnabled = true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude '.readme'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'

        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/MANIFEST.MF'
        exclude 'META-INF/rxjava.properties'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        pickFirst 'AndroidManifest.xml'
    }



    dexOptions {
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }


    //noinspection GradleCompatible

    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'eu.inloop:localmessagemanager:0.1.5'
    compile 'com.jakewharton:butterknife:8.8.1'
    compile 'com.koushikdutta.ion:ion:2.2.1'
    compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.cocosw:bottomsheet:1.3.0@aar'
    compile 'com.zhy:flowlayout-lib:1.0.3'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.3.0'
    compile 'com.andkulikov:transitionseverywhere:1.7.4'
    compile 'com.master.android:permissionhelper:1.1'
    compile 'net.alhazmy13.MediaPicker:libary:2.3.2'
    compile 'com.github.jaychang0917:SimpleText:1.2.1'
    compile 'com.github.tabassumLatif:ShimmerRecyclerView:0.1.2'
    compile 'com.tomergoldst.android:tooltips:1.0.6'
    compile 'com.github.Pixplicity:sharp:03c1568d26'
    compile 'id.zelory:compressor:2.0.0'
    compile 'com.github.danikula:AndroidVideoCache:v2.7.0'
    compile ('com.google.firebase:firebase-messaging:11.0.2'){
        force = true
    }
    compile 'com.fenchtose:tooltip:0.1.5'
    compile 'com.jsibbold:zoomage:1.1.0'
    compile 'at.blogc:expandabletextview:1.0.3'
    compile 'com.github.douglasjunior:android-simple-tooltip:0.2.1'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
    compile 'com.oginotihiro:cropview:1.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.wonderkiln:camerakit:0.11.0'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    compile('com.android.support:support-v4:26.1.0'){
        force = true
    }
}
apply plugin: 'com.google.gms.google-services'

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
//        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
//        classpath 'com.google.firebase:firebase-plugins:1.0.5'
        classpath 'com.google.gms:google-services:3.0.0'
//        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.3"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://plugins.gradle.org/m2/" }
        /*maven {
            url "https://maven.google.com"
        }*/
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 个答案:

答案 0 :(得分:0)

阅读评论,并自己解决这个问题,问题似乎源于一个糟糕的第三方库。也许使用不兼容的gradle或buildtool库。

问题库:

  • com.wonderkiln:camerakit:0.11.0
  • android.arch.persistence.room
  • com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer

其他人在/libs文件夹中存在类似的问题。