2017-02-27 9 views
0

org.apache.http.legacyライブラリを使用するライブラリプロジェクト(Janrain:Jump)があります。私は私のプロジェクトをビルドしようとすると、私は次のような重複エラーが表示されます。Apacheコモンズの依存関係は、gradleで除外されません。 Android

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/commons/codec/StringEncoderComparator.class 

だから私は、受け付けを開始、それを使用しているためorg.apache.commonsが重複したエントリであることを考え出し、それはまた、(外部ライブラリなど)のAndroid 24に含まれています。以下のようなジャンプのGradle:だから私はからコモンズを削除しようとした

configurations { 
    all*.exclude group: 'org.apache.commons' 
} 

今、私はこれがorg.apache.commons削除することを期待したいが、私はまだ重複したエントリのGradleエラーが発生します。私はそれが構成に含まれている場合のGradleファイルなぜorg.apache.commonsも除外されていない

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.3" 
    //If building with strict Android 6.0 the following will need to be uncommented 
    //See: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html 
    //And: http://stackoverflow.com/questions/31653002/how-to-use-the-legacy-apache-http-client-on-android-m 
    useLibrary "org.apache.http.legacy" 

    defaultConfig { 
     minSdkVersion 17 
     targetSdkVersion 24 
     // replace the below string with your own Google client ID. Make sure this is consistent 
     // with the values used in openid_appauth_idp_configs.xml 
     manifestPlaceholders = [ 
       <my values>] 
    } 

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

    } 
} 

configurations { 
    all*.exclude group: 'org.apache.commons' 
} 

dependencies { 
    compile 'com.android.support:support-v4:24.2.0' 
    compile files('libs/org.apache.http.legacy.jar') 
    compile 'com.squareup.okhttp:okhttp:2.5.0' 
    compile 'com.squareup.okhttp:okhttp-apache:2.5.0' 
    compile 'com.squareup.okio:okio:1.6.0' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.squareup.retrofit:retrofit:1.8.0' 
    compile 'net.openid:appauth:0.4.1' 
} 

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

を移動:ここ

はありますか?

答えて

1

はちょうどその瓶

task findDuplicates { 
    doLast { 
     def findMe = 'org/apache/commons/codec/StringEncoderComparator.class' 
     configurations.runtime.asFileTree.matching { 
      include '**/*.jar' 
     }.files.each { File jarFile -> 
      zipTree(jarFile).visit { FileVisitDetails fvd -> 
       if (fvd.path == findMe) { 
        println "Found $findMe in $jarFile.name" 
       } 
      } 
     } 
    } 
} 
+0

うんを見つけることgradle findDuplicatesを実行して、あなたのbuild.gradleにこのタスクを追加し、重複を追加して、それが今で固定されているものを考え出しました。 – Nerd

関連する問題