android.support.v4.net。*类已添加到输出中

时间:2014-12-05 14:27:22

标签: android android-gradle

我刚刚更新到Android Studio 1.0 RC 4,它给了我一些奇怪的错误,但我无法弄清楚原因。

错误是:

Error:Class android.support.v4.net.ConnectivityManagerCompatGingerbread has already been added to output. Please remove duplicate copies.
Error:Class android.support.v4.net.TrafficStatsCompat has already been added to output. Please remove duplicate copies.

我的build.gradle(编译部分)是:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //compile 'com.android.support:support-v4:19.+'
    compile 'com.fasterxml.jackson.core:jackson-core:2.3.2'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.3.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
    compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
    compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
    //compile 'com.github.mrengineer13:snackbar:0.4.0'
    //compile 'com.android.support:support-v4:21.0.0'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.android.support:appcompat-v7:21.0.+'
    //compile 'com.android.support:cardview-v7:21.0.+'
    //compile 'com.android.support:recyclerview-v7:21.0.+'
    compile 'com.pnikosis:materialish-progress:1.0'
}

我已经在其他一些问题中读到了它依赖于两个依赖于v4的相同类的依赖关系,但我无法弄清楚哪些类。

我希望有人可以提供帮助。

1 个答案:

答案 0 :(得分:0)

首先,尝试将您正在使用的杰克逊版本从 2.3.2 更新为2.4.0。 这是您的新代码:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:support-v4:19.+'
compile 'com.fasterxml.jackson.core:jackson-core:2.4.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.0'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
//compile 'com.github.mrengineer13:snackbar:0.4.0'
//compile 'com.android.support:support-v4:21.0.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.android.support:appcompat-v7:21.0.+'
//compile 'com.android.support:cardview-v7:21.0.+'
//compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.pnikosis:materialish-progress:1.0'

}

它为我编译。