摇篮生成失败 - JAVA.EXE完成非零退出值2 [英] Gradle Build failed - Java.exe is finished with non-zero exit value 2

查看:120
本文介绍了摇篮生成失败 - JAVA.EXE完成非零退出值2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加的gradle recyclerview构建和再尝试运行应用程序,现在我得到这个错误:

I have added recyclerview gradle build and then tried to run the app, and now I get this error:

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

Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'C:\\ Program Files文件\\的Java \\ jdk1.7.0_79 \\斌\\ java.exe的'完成非零退出值2

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

下面是我的gradle这个构建文件:

Here is my gradle build file:

dependencies {
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.parse.bolts:bolts-android:1.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.fresco:fresco:0.5.2+'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile fileTree(dir: 'libs', include: 'commons-io-*.jar')
compile fileTree(dir: 'libs', include: 'ParseFacebookUtilsV4-*.jar')
}

如何解决这一问题?

How to fix this?

推荐答案

看起来你已经达到了极限DEX,你必须在你的应用程序超过65K的方法。

It looks like you have reached the dex limit and you have over 65k methods in your application.

如果你想保持你的所有的Gradle依赖的是,你应该看看配置multidex 这样,它会使用多个DEX文件,构建应用程序。

If you want to keep all of your gradle dependencies as is, you should look into configuring multidex that way it will build your application using multiple dex files.

另一种解决办法是尝试并删除任​​何不必要的依赖从谷歌Play服务库。机会是你不需要包含一切,你可以选择只添加你需要的进口。

Another solution would be to try and remove any unnecessary dependencies from the google play services library. Chances are you don't need to include everything and you can choose to add only the imports you need.

例如:

com.google.android.gms:play-services-maps:7.5.0
com.google.android.gms:play-services-gcm:7.5.0

而不是简单地使用:

Rather than simply using:

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

您可以参考谷歌播放服务指南来决定你应该增加哪些库件。

You can reference the Google Play Services guide to determine which pieces of library you should add.

这篇关于摇篮生成失败 - JAVA.EXE完成非零退出值2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆