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

duplicate entry android support v4 in serviceinfoversion impl.class

我有这个错误:

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 天内解决 谢谢计算器

您最新评论中的错误与您 Activity 中的 XML 问题完全不同。

您不需要明确的 support-v4 依赖项。它包含在 v7 依赖项中。话虽这么说,绝对不需要force = true就可以了

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

的两个依赖项

我遇到了类似的问题,我正在导入

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

并且必须添加“@aar”终止符

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

这对我有用。

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