2

更新到 android studio 2.1 后,当我尝试使用新的 gradle 时,我的项目开始崩溃,有点:

错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。> com.android.build.api.transform.TransformException:java.util.zip.ZipException:>重复条目:org/objectweb/asm/tree/AbstractInsnNode.class

摇篮:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "application.id.is.here"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding
            {
                enabled = true
            }
    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = true
    }
}

    repositories {
    mavenCentral()
}

    dependencies {
     //compile fileTree(dir: 'libs', include: ['*.jar'])
     compile('com.mikepenz:materialdrawer:4.6.4@aar') {
        transitive = true
     }
    compile 'com.android.support:multidex:1.0.1+'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.android.support:design:23.1.1'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.vk:androidsdk:+'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.android.tools.build:gradle:2.1.0+'
    compile ('com.google.android.gms:play-services-maps:8.3.0'){
        exclude group: 'com.android.support', module: 'support-v4'
    }
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp:2.7.2+'
 }

    configurations {
        all*.exclude group: 'commons-logging', module: 'commons-logging'
    }

和顶级构建:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
    }
}

allprojects {
    repositories {
        jcenter()
    }

    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}

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

如果您有任何想法 - 请提供帮助。我为这个问题找到的解决方案都没有为我解决。

4

1 回答 1

0

伊戈尔的回答对我有用。我遇到了完全相同的问题(在获得所有这些排除项之后)。运行 Android Studio 2.1 有点痛苦。

退出 Android Studio 然后清除缓存:

cd ~/.gradle/caches
rm -r *

重新启动 Android Studio,现在它应该可以工作了。

于 2016-05-07T13:49:31.923 回答