4

次の問題に数時間取り組んでいますが、問題を解決する方法が思いつきません。Stack Overflow から次の修正を試みました ( Android Studio を 1.0 に更新すると、 MultiDex が破損し、Gradle Plugin v0.13.1 の後に Zip エントリが複製されます)、いずれも機能しませんでした。

プログラムをビルドしようとすると、次のエラーが発生します。

Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: org/apache/commons/io/CopyUtils.class

このエラーは、commons-io がビルド プロセスに 2 回含まれていることを示しているようです。

Android Studio と Gradle を使用して、複数の Robospice 依存関係を含めています。これは、私の Gradle ビルド ファイルの依存関係セクションです。

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.google.android.gms:play-services:6.5.87'

    compile'com.google.api-client:google-api-client-android:1.19.0'


    // You must install or update the Google Repository through the SDK manager to use this dependency.
    // The Google Repository (separate from the corresponding library) can be found in the Extras category.
    //compile 'com.google.android.gms:play-services:4.3.23'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.jakewharton:butterknife:${butterknifeVersion}"
    compile 'com.sun.jersey:jersey-bundle:1.8'
    compile 'com.google.code.gson:gson:2.3'
    compile 'org.codehaus.jackson:jackson-core-asl:1.9.0'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.0'

    compile ('com.octo.android.robospice:robospice:1.4.14'){
        exclude module: 'commons-io'
        exclude group: 'commons-io'
    }

    compile ('com.octo.android.robospice:robospice-spring-android:1.4.14'){
        exclude group: 'org.apache.commons', module: 'commons-io'
    }

    compile 'com.squareup.okhttp:okhttp:2.1.0'

    compile ('com.octo.android.robospice:robospice-google-http-client:1.4.14'){
        exclude module: 'xpp3'
        exclude group: 'stax'
    }

    compile 'org.scribe:scribe:1.3.5'
    compile files("$buildDir/native-libs/native-libs.jar")

}

「gradlew -q dependencies app:dependencies」コマンドを使用してプロジェクトの依存関係ツリーを表示すると、com.octo.android.robospice:robospice:1.4.14 が commons-io ライブラリに依存していることがわかります。プロジェクトの依存関係ツリーの関連するスニペットは次のとおりです。

+--- com.octo.android.robospice:robospice:1.4.14
|    \--- com.octo.android.robospice:robospice-cache:1.4.14
|         +--- org.apache.commons:commons-lang3:3.3.2
|         \--- org.apache.commons:commons-io:1.3.2
|              \--- commons-io:commons-io:1.3.2

Gradle ビルド ファイルですべての Robospice 関連の依存関係から commons-io を除外したにもかかわらず、依存関係はまだリストされています。また、グループ名を commons-io から org.apache.commons に変更しようとしましたが、それもうまくいきませんでした。

これが解決されるまで、私のプロジェクトは停止しています。

4

2 に答える 2