重复条目:com / google / android / gms / common / SupportErrorDialogFragment.class

时间:2015-07-04 12:23:53

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

我正在android studio中创建具有multi dex支持的项目。我收到错误:java.util.zip.ZipException:重复条目:com / google / android / gms / common / SupportErrorDialogFragment.class。我知道这个问题适用于重复课程。但无法弄清楚哪个类正在重复以及如何修复它。下面是我的build.gradle的代码。请建议。感谢。

android {
    compileSdkVersion 19
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.rtpl.create.app.v2"
        minSdkVersion 14
        targetSdkVersion 19

        // Enabling multidex support.
        multiDexEnabled true

    }

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

dependencies {
    compile project(':pageIndicator')
    compile project(':materialDesign')
    compile project(':zxingLib')
    compile project(':datetimepickerlibrary')
    compile project(':facebookSDK')
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/Android_SDK.jar')
    compile files('libs/Android_SDK_component.jar')
    compile files('libs/crashlytics.jar')
    compile files('libs/google-play-services.jar')
    compile files('libs/im.jar')
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/linkedin-j-android.jar')
    compile files('libs/PayPal_MECL.jar')
    compile files('libs/prime-0.6.1.jar')
    compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
    compile files('libs/signpost-core-1.2.1.1.jar')
    compile files('libs/signpost-jetty6-1.2.1.1.jar')
    compile files('libs/socialauth-4.2.jar')
    compile files('libs/socialauth-android-2.6.jar')
    compile files('libs/twitter4j-core-3.0.5.jar')
    compile files('libs/universal-image-loader-1.9.1-SNAPSHOT-with-sources.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile files('libs/gcm.jar')
    compile 'com.android.support:multidex:1.0.0'

}

1 个答案:

答案 0 :(得分:3)

build.gradle中存在冲突的依赖项,这意味着包含相同类的多个依赖项:

compile files('libs/Android_SDK.jar')
compile files('libs/Android_SDK_component.jar')

所有这些组件均由Google Play服务提供(列表中的第一个)。因此,您应该只声​​明一次Google Play服务,最好只声明您使用的组件而不是完整的软件包:请参阅"有选择地将API编译到您的可执行文件中#34; https://developers.google.com/android/guides/setup

在简化项目依赖性之后,你甚至不需要使用multidex。

另外(不相关),我想知道这些依赖项是什么,如果它是Android框架本身你可以删除它们:

#!/bin/bash

### make sure that the script is called with `nohup nice ...`
if [ "$1" != "calling_myself" ]
then
    # this script has *not* been called recursively by itself
    datestamp=$(date +%F | tr -d -)
    nohup_out=nohup-$datestamp.out
    nohup nice "$0" "calling_myself" "$@" > $nohup_out &
    sleep 1
    tail -f $nohup_out
    exit
else
    # this script has been called recursively by itself
    shift # remove the termination condition flag in $1
fi

### the rest of the script goes here
. . . . .