2016-03-03 178 views
-1

我的应用程序gradle文件如下所示。Android:错误:任务执行失败':app:dexDebug'

dependencies { 
      compile fileTree(dir: 'libs', include: ['*.jar']) 
      testCompile 'junit:junit:4.12' 
      compile project(':purpleb2b') 
      compile 'com.android.support:appcompat-v7:23.1.1' 
      compile 'com.android.support:design:23.1.1' 
      compile 'com.android.support:support-v4:23.1.1' 
      compile 'com.jakewharton:butterknife:7.0.1' 
      compile 'com.android.support:cardview-v7:23.1.1' 
      compile 'com.squareup.picasso:picasso:2.5.2' 
      compile 'com.thomashaertel:multispinner:0.1.1' 
      compile 'com.itextpdf.tool:xmlworker:5.5.8' 
      compile 'com.google.android.gms:play-services:8.4.0' } 

当我添加最后一个库(播放服务)时,它给了我下面的错误。

Error:Execution failed for task ':app:dexDebug'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 

的purpleb2b是自定义库中的项目和它的依赖关系如下

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'de.greenrobot:greendao:2.0.0' 
    compile 'com.google.code.gson:gson:2.4' 
    compile 'me.neavo:volley:2014.12.09' 
    compile 'org.apache.httpcomponents:httpmime:4.3.1' 
    compile 'org.apache.httpcomponents:httpcore:4.3.1' 
    compile 'itext:itext:1.3.1' 
    compile 'org.json:json:20151123' 
    compile 'com.opencsv:opencsv:3.6' 
    compile 'org.apache.httpcomponents:httpclient:4.5' 
} 

如果我删除播放业务一切正常。 能否请你帮我解决这个问题...

+0

冲突'编译'com.android.support:appcompat-v7''使用任何一个 –

+0

添加multiDexEnabled true ... –

+0

您可以粘贴您的完整gradle文件吗?你的build.gradle文件也是。您是否在那里添加了“com.google.gms:google-services”依赖关系? –

回答

1

这是因为播放服务造成65536种方法错误。尝试使用您需要的特定服务。您可以找到库的完整概述there

+0

谢谢viktor那个链接。解决了这个问题 – Minto

0

简单的在你的gradle这个文件中添加这些......

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.2" 

defaultConfig { 

    minSdkVersion 14 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 

    // Enabling multidex support. 
    multiDexEnabled true 

} 

// add dexOptions 
dexOptions { 
    incremental true 
    javaMaxHeapSize "4g" 
} 
// Add 
packagingOptions { 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/dependencies.txt' 
     exclude 'META-INF/LGPL2.1' 
    } 
} 


dependencies { 
provided fileTree(include: ['*.jar'], dir: 'libs') 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:23.1.1' 
compile 'com.android.support:support-v4:23.1.1' 
compile 'com.android.support:design:23.1.1' 
compile 'com.parse:parse-android:1.11.0' 
// add multidex dependency 
compile 'com.android.support:multidex:1.0.1' 

} 

参考:Error:Execution failed for task ':app:dexDebug' error in my project while I added new dependency

+0

确保U没有在您的项目中添加重复的库(Dependency)。 –

相关问题