serviceinfoversion impl.class中的重复条目android支持v4

时间:2016-10-29 15:42:28

标签: java android gradlew

我有这个错误:

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

在这个build.gradle应用程序上:

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.mtma.mytripmyadventure"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile('com.android.support:support-v4:23.4.0') {
        force = true;
    }
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.roughike:bottom-bar:1.2.1'
    compile 'com.google.android.gms:play-services-maps:9.8.0'
    compile 'com.android.support:support-v4:23.4.0'
}

我尝试了许多事情,但结果仍然相同

我添加了所有* .exclude组:'com.android.support',模块:'support-v4'

但仍然是错误

帮我解决这个问题。在1天内解决它 thx stackoverflow

3 个答案:

答案 0 :(得分:1)

您最新评论中的错误完全不同,因为它与您的Activity中的XML问题有关。

您不需要显式支持-v4依赖项。它包含在v7依赖项中。话虽如此,绝对不需要force = true就可以了

第一个错误的解决方案是删除compile 'com.android.support:support-v4

的两个依赖项

答案 1 :(得分:1)

我有类似的问题,我正在导入

compile fr.avianey.com.viewpagerindicator:library:2.4.1.1'

并且必须添加" @ aar"终止

compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'

答案 2 :(得分:0)

这对我有用。

compile('com.jakewharton:butterknife:8.5.1') {
        exclude module: 'support-compat'
}