使用 Robospice 和 Android Studio 的 Commons-Io 重复输入错误 [英] Commons-Io Duplicate Entry Error Using Robospice and Android Studio

查看:33
本文介绍了使用 Robospice 和 Android Studio 的 Commons-Io 重复输入错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经针对以下问题研究了几个小时,但还没有想出解决我的问题的方法.我已经尝试了 Stack Overflow 的以下修复(Android Studio 更新到 1.0损坏 MultiDexGradle Plugin v0 后的重复 Zip 条目.13.1) 但他们都没有工作.

I've been working on the following issue for several hours, but haven't come up with a way to solve my problem. I've tried the following fixes from Stack Overflow (Android Studio update to 1.0 corrupts MultiDex and Duplicate Zip Entry after Gradle Plugin v0.13.1) but neither one of them worked.

我在尝试构建我的程序时收到以下错误:

I am getting the following error when trying to build my program:

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

该错误似乎表明 commons-io 在构建过程中被包含了两次

The error seems to indicate that commons-io is being included twice in the build process

我正在使用 Android Studio 和 Gradle 来包含多个 Robospice 依赖项.这是我的 Gradle 构建文件的依赖项部分:

I am using Android Studio and Gradle to include multiple Robospice dependencies. This is the dependencies section of my Gradle build file:

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库.这是项目依赖树的相关片段:

Using the "gradlew -q dependencies app:dependencies" command to view the project's dependency tree indicates that com.octo.android.robospice:robospice:1.4.14 is dependent on the commons-io library. Here is the relevant snippet of the project dependency tree:

+--- 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,但也没有用.

The dependency is still listed even though I excluded commons-io from all Robospice related dependencies in the gradle build file. I also tried changing the group name from commons-io to org.apache.commons, and that did not work either.

在我解决这个问题之前,我的项目处于停滞状态,如果我能得到任何帮助,我将不胜感激.

My project is at a standstill until I get this resolved, and I would appreciate any help I can get.

推荐答案

这是 Robospice 中已知且已修复的问题,由底层 Gradle 2.1 问题引起:https://github.com/stephanenicolas/robospice/issues/365.该修复程序将在下一个版本中发布.

This is a known and fixed problem in Robospice, caused by an underlying Gradle 2.1 issue: https://github.com/stephanenicolas/robospice/issues/365. The fix is going to be released in the next version.

您可以通过从 所有 Robospice 依赖项中排除 org.apache.commons:commons-io 来解决它,并包括 commons-io:commons-io:1.3.2 手动.像这样:

You can work around it by excluding org.apache.commons:commons-io from all Robospice dependencies, and include commons-io:commons-io:1.3.2 manually. Like this:

// workaround (https://github.com/stephanenicolas/robospice/issues/365)
// remove when robospice updates to 1.4.15+
compile ('com.octo.android.robospice:robospice-retrofit:1.4.14') {
    exclude group: 'org.apache.commons', module: 'commons-io'
}
compile ('com.octo.android.robospice:robospice-ormlite:1.4.14') {
    exclude group: 'org.apache.commons', module: 'commons-io'
}
compile 'commons-io:commons-io:1.3.2'

这篇关于使用 Robospice 和 Android Studio 的 Commons-Io 重复输入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆