Android Studio-Java.exe is finished with non-zero exit value 2

前端 未结 7 890
故里飘歌
故里飘歌 2021-01-13 05:07

When I try to Run my app, I am getting this error:-

Error:Execution failed for task \':app:dexDebug\'.
> com.android.ide.common.process.ProcessException:          


        
相关标签:
7条回答
  • 2021-01-13 05:24

    Just add below line in your app Gradle dependencies

    compile 'com.android.support:multidex:1.0.0'
    

    and then below line in defaultConfig

    multiDexEnabled true
    
    0 讨论(0)
  • 2021-01-13 05:26

    Edit gradle.properties file. change this line:

    org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
    

    to:

    org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
    
    0 讨论(0)
  • 2021-01-13 05:31

    Just do this Build > Clean project

    It works

    0 讨论(0)
  • 2021-01-13 05:32

    This happened for me when I was refactoring some class files to a library project and I had a duplicate name of a class file. So, double check that you do not have any duplicate names. This also appears to be a duplicate of the question here: android project: process finished with non-zero exit value 2

    0 讨论(0)
  • 2021-01-13 05:35

    I got this error when I used the beta version of gradle to test Vector Asset. This error perssisted even after I switched back to stable Gradle version 1.3.0.
    The error was fixed after I used Build > Clean project

    0 讨论(0)
  • 2021-01-13 05:36

    Encountered same problem today. I fixed this problem by closing other applications to release more memory to finish build process.

    When getting this error:

    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

    Use process explorer to find out the command line parameter of java.exe, then run complete command in CMD window to see what the error message is. Mine contains "HeapDumpOnOutOfMemoryError", So I close other applications to release more memory, then problem fixed.

    0 讨论(0)
提交回复
热议问题