2016-05-17 68 views
0

我收到应用程序:试图在Android Studio上运行我的项目时出现dexDebug错误。我相信这与我的依赖有关,但我不确定我出错的地方。应用:build.gradle中的dexDebug错误Android Studio

的错误是:

错误:执行失败的任务 ':应用程序:dexDebug'。是

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_17\bin\java.exe'' finished with non-zero exit value 2

我在的build.gradle文件依赖性如下:

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:23.2.1' 
compile 'com.android.support:design:23.2.1' 
compile 'com.facebook.android:facebook-android-sdk:[4,5)' 
compile 'com.google.android.gms:play-services:8.3.0' 
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE' 
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2' 
} 

任何人都可以点我在正确的方向在这里,请。

谢谢。

UPDATE

问题通过添加解决以下我的build.gradle

packagingOptions { 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/NOTICE' 
    } 
+0

你是否确实使用过搜索功能? http://stackoverflow.com/questions/28429546/how-to-fix-this-gradle-appdexdebug-error Regards – sehe

+0

我知道相同的库是为了相同的版本,但我怎么能够定义' com.android.support:design'来匹配'com.android.support:appcompat'?你不能简单地把'com.android.support:design-v7',所以我正在寻找援助,因为我是这个发展的新手。 – User10

回答

1

Android Studio中Error:Execution failed for task ':app:dexDebug'来解决它在你的gradle这个文件中设置multiDexEnabledtrue

defaultConfig {   
    // Enabling multidex support. 
    multiDexEnabled true 
} 
1

该问题很可能是由于添加了所有播放服务依赖关系造成的。您不应该将整个API包编译到您的应用程序中,它会增加应用程序中的方法数量。 app:dexDebug错误表明你已经超过了65k的方法限制。删除build.gradle中的这一行:compile 'com.google.android.gms:play-services:8.3.0' 然后从这些seperate dependencies中进行选择,根据您的应用需要添加哪些。例如使用Gcm,你只需要添加compile 'com.google.android.gms:play-services-gcm:8.4.0'

相关问题