Search code examples
androidandroid-studioout-of-memoryheap-memorytoplevel

Android Studio errors. After trying so many solution not able to configure it out.PC RAM 4gb


Error:UNEXPECTED TOP-LEVEL ERROR:

Error:java.lang.OutOfMemoryError: Java heap space

Error:Picked up _JAVA_OPTIONS: -Xmx512M

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe'' finished with non-zero exit value 3


Solution

  • I have go through several solutions. I have found the issue was my PC allocation only 494m memory to java heap, so that i have tried many things.

    --Set java heap size to 3g.

    --Set java variable to 2048m.

    then, i did free some space in my PC, after that my PC is capable of giving 990m to java heap(Application building successfully now).

    --Make sure to check gradle console.