重复的zip条目[classes.jar:android / support / v4 / media / MediaBrowserCompat $ MediaItem $ 1.class]

时间:2018-06-04 07:08:23

标签: android android-studio gradle build run-app

我的应用程序建立成功 但是当我尝试在手机上运行或生成签名的apk时,它会显示以下错误:

Error:Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [D:\new order\New folder\Cash Rewards Android Studio Project\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Tonu\.gradle\caches\transforms-1\files-1.1\support-media-compat-27.1.1.aar\74c0d7272a41b9a26a44494f0220b268\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/v4/media/MediaBrowserCompat$MediaItem$1.class]))

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
BUILD FAILED in 11s

我的应用级别build.gradle如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "online.mobilebucks.app"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 101
        versionName "1.0.1"

        multiDexEnabled true


    }

    aaptOptions {
        additionalParameters "--no-version-vectors"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        configurations.all{
            resolutionStrategy.force 'com.android.support:animated-vector-drawable:27.1.1'
            resolutionStrategy.force 'com.android.support:cardview-v7:27.1.1'
            resolutionStrategy.force 'com.android.support:palette-v7:27.1.1'



        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }

    dexOptions {

        javaMaxHeapSize "4g"
    }
}



//Include Supersonic maven repositories
repositories {
    maven {
        url "https://dl.bintray.com/supersonic/android-sdk"
    }
    maven {
        url "http://dl.bintray.com/supersonic/android-adapters"
    }
    maven { url "https://bitbucket.org/adscend/androidsdk/raw/master/" }


    maven {
        url  "https://adcolony.bintray.com/AdColony"
    }

    flatDir {
        dirs 'libs'
    }

    maven {
        url "https://mymavenrepo.com/repo/dT2TdROtzilvjRTJOVps/"
    }

    maven {
        url "https://dl.bintray.com/ironsource-mobile/android-sdk"
    }
    maven {
        url 'https://dl.bintray.com/personaly/maven'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    // MultiDex Dependency
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:design:27.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.18'
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
    //noinspection GradleCompatible
    compile 'com.google.android.gms:play-services-gcm:10.2.1'
    compile 'com.google.android.gms:play-services-location:10.2.1'
    compile 'com.google.android.gms:play-services-ads:10.2.1'
    compile 'com.google.android.gms:play-services-auth:10.2.1'
    compile 'com.google.android.gms:play-services-analytics:10.2.1'
    compile 'com.google.android.gms:play-services-basement:10.2.1'
    //compile 'com.google.android.gms:play-services-appindexing:10.2.1'
    compile 'com.intuit.sdp:sdp-android:1.0.3'
    // DatabasePackage
    compile 'com.neovisionaries:nv-websocket-client:2.3'
    compile 'com.percolate:caffeine:0.3.3'
    compile 'com.koushikdutta.async:androidasync:2.2.1'
    compile 'com.google.android.gms:play-services-base:10.2.1'
    compile 'com.percolate:caffeine:0.3.3'
    compile 'com.koushikdutta.async:androidasync:2.2.1'
    compile 'com.supersonic.sdk:mediationsdk:6.4.17@jar'
    compile 'com.adcolony:sdk:3.0.5'
    compile 'com.android.support:support-annotations:25.3.1'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.code.gson:gson:2.6.2'
    compile files('libs/whitemobisdk_1.0.3.jar')
    compile files('libs/revmob.jar')
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.firebase:firebase-messaging:10.2.1'
    compile 'com.google.android.gms:play-services-ads:10.2.1'
    compile 'com.google.code.gson:gson:2.6.2'
    compile files('libs/vungle-publisher-adaptive-id-4.0.2.jar')
    compile files('libs/adscendmedia1.0.1.jar')
    // Adcash SDK:
    compile 'com.adcash:adcash-sdk-lib:2.4.0'
    compile(name: 'OfferToroSdk-v3.1.9', ext: 'aar')
    compile project(':KiwiSDK')
    compile 'com.android.support:recyclerview-v7:27.1.1'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile('com.expletus.rubicko:rubicko:1.0.1@aar') {
        exclude group: 'com.google.code.gson'
        exclude group: 'com.android.volley'
        transitive = true
    }
    compile 'com.ironsource.sdk:mediationsdk:6.7.9@jar'
    compile 'com.startapp:inapp-sdk:3.8.4'
    compile 'com.theoremreach:theoremreach:3.2.7'
    implementation files('libs/AdxmiSdk_v5.7.0_2016-05-06.jar')
    implementation 'com.github.d-max:spots-dialog:0.7@aar'
    compile 'ly.persona.sdk:personaly:1.0.678@aar'
    implementation files('libs/android-support-v4-1.jar')
}
apply plugin: 'com.google.gms.google-services'

我搜索过,但没有找到任何帮助。我也尝试使缓存无效。

1 个答案:

答案 0 :(得分:1)

当使用2个版本的支持库时,通常会发生此问题。在您的gradle中更改以下内容。

1)改变

'com.android.support:support-annotations:25.3.1'

'com.android.support:support-annotations:27.1.1'

2)改变

implementation files('libs/android-support-v4-1.jar')

implementation 'com.android.support:support-v4:27.1.1'