Java finished with non-zero exit value 2 - Android Gradle

Error:Execution failed for task ':dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/tim/soft/jdk1.8.0/bin/java'' finished with non-zero exit value 2

当项目使用gradle编译的时候,引用的其他库越来越多的时候,run的时候会报上面的错。

最可能的原因就是65K methods dex limit imposed by Android.

解决方案:

defaultConfig {        
    // Enabling multidex support.
    multiDexEnabled true
}

参考:

http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle

https://developer.android.com/intl/ko/tools/building/multidex.html

你可能感兴趣的:(android,issue)