Error:Execution failed for task ':sampleAppProject:dexDebug'

Error:Execution failed for task ':sampleAppProject:dexDebug'

我刚刚更新了我的 sdk tp 版本 23,以便在我的应用程序中更新我的库,但是当涉及到 运行 应用程序时,出现以下错误:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java'' 以非零退出值 2 结束, 我检查了它的意思,它说我的应用程序和库中可能存在像 android 模块 v4 和 v7 这样的库重复 post 说要排除这些库以防止重复,但我没有实现这里是我的应用程序 gradle 希望有人能帮我实现这个谢谢。

enter code here
apply plugin: 'com.android.application'

  android {

signingConfigs {
    XXXX_release {
        keyAlias 'XXXX'
        keyPassword '123456'
        storeFile file('XXX')
        storePassword '123456'
    }
}
compileSdkVersion 23
buildToolsVersion '23.0.0'
lintOptions
        {
            checkReleaseBuilds false
            //abortOnError true
        }
defaultConfig {
    applicationId 'XXXXXX'
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 4
    versionName "1.0"
    multiDexEnabled true
}
buildTypes
        {
            release {
                minifyEnabled true
                proguardFiles './proguard-rules.pro'
                //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

            }
        }
dexOptions {
    preDexLibraries = false
    incremental true
}
configurations {
   //all*.exclude group: 'com.android.support',module: 'support-v4'
   // all*.exclude group: 'com.android.support',module: 'appcompat-v7'
}
productFlavors {
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
compile files('Libraries/org.apache.http.legacy.jar')
compile project('Libraries:UniversalImageLoader')
compile project('Libraries:facebook')
compile files('Libraries/gcm.jar')
compile files('Libraries/quickblox-android-sdk-chat-2.0.jar')
compile files('Libraries/quickblox-android-sdk-core-2.0.jar')
compile files('Libraries/quickblox-android-sdk-messages-2.0.jar')
compile files('Libraries/YouTubeAndroidPlayerApi.jar')
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'me.dm7.barcodescanner:zbar:1.6'
compile 'me.dm7.barcodescanner:zxing:1.6'
 }

发现结果:

compile 'com.google.android.gms:play-services:7.8.0' 

这是导致超过 65k 方法的原因,因此将其删除,gradle 同步,清理项目,然后再次 运行 然后此错误停止。我只需要地图、gcm 和广告,所以我放了这些行:

compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.google.android.gms:play-services-ads:7.8.0'

同步项目,错误消失,不需要整个播放服务。 希望这会帮助任何面临此问题的人。