Gradle Error:重复条目:com / android / volley / AuthFailureError.class

时间:2016-05-13 07:02:59

标签: android android-studio android-gradle build.gradle

我在我的项目中导入了EBS Sdk。现在,gradle构建成功但是在运行时

  Error:Execution failed for task':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/volley/AuthFailureError.class**

发生此异常。

以下是app和模块的build.gradle 我搜索并尝试了所有可能性,但我没有得到结果

应用程序/的build.gradle

 apply plugin: 'com.android.application'

 android {
       compileSdkVersion 23
      buildToolsVersion '23.0.2'
   configurations {
      all*.exclude group: 'com.android.volley', module: 'library-aar-1.0.0'
}
defaultConfig {
    applicationId 'com.app.sanyog'
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 3
    versionName "1.2"
    multiDexEnabled = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
 }
android {
     packagingOptions {
        pickFirst 'META-INF/LICENSE.txt' // picks the JavaMail license file
    }
 }
   repositories {
       mavenCentral()
    }
 dependencies {

compile project(':EBS')

compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'


compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile "com.android.support:gridlayout-v7:23.1.1"
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.android.support:multidex:1.0.1'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.wdullaer:materialdatetimepicker:2.0.0'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.1.3'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.bignerdranch.android:expandablerecyclerview:2.1.1'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'javax.mail:mail:1.4.1'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')




 }

EBS /的build.gradle

  apply plugin: 'android-library'

  dependencies {
       compile files('libs/ebs.jar')
       compile files('libs/volley.jar')

    }

 android {
      compileSdkVersion 19
       buildToolsVersion "23.0.2"

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    // Move the tests to tests/java, tests/res, etc...
    instrumentTest.setRoot('tests')

    // Move the build types to build-types/<type>
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
    // This moves them out of them default location under src/<type>/... which would
    // conflict with src/ being used by the main source set.
    // Adding new build types or product flavors should be accompanied
    // by a similar customization.
    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
  }
 }

2 个答案:

答案 0 :(得分:3)

您只需在yout app中添加以下行:gradle

 configurations{
    all*.exclude group: 'com.android.volley'
}

答案 1 :(得分:1)

尝试清理gradle运行这些命令

@Override
    public void onBackPressed() {    
        if(isBottomViewOpen){ // set this bool in behavior callback
            behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        }else {
            super.onBackPressed();
        }
    }

选中此question