Android Gradle Packaging FAQs and Solutions

Source: Internet
Author: User

Background:

Problem:

q1:unexpected top-level ERROR:java.lang.OutOfMemoryError:Java heap spaceat Com.android.dx.cf.direct.MethodListParser.set (methodlistparser.java:80) at Com.android.dx.cf.direct.MemberListParser.parse (memberlistparser.java:217) at Com.android.dx.cf.direct.MemberListParser.parseIfNecessary (memberlistparser.java:108) at Com.android.dx.cf.direct.MethodListParser.getList (methodlistparser.java:54) at COM.ANDROID.DX.CF.DIRECT.DIRECTCLASSFILE.PARSE0 (directclassfile.java:542) at Com.android.dx.cf.direct.DirectClassFile.parse (directclassfile.java:406) at Com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary (directclassfile.java:388) at Com.android.dx.cf.direct.DirectClassFile.getMagic (directclassfile.java:251) at Com.android.dx.command.dexer.Main.parseClass (main.java:764) at com.android.dx.command.dexer.main.access$1500 ( main.java:85) at Com.android.dx.command.dexer.main$classparsertask.call (main.java:1684) at Com.android.dx.command.dexer.Main.processClass (main.java:749) at Com.android.dx.commAnd.dexer.Main.processFileBytes (main.java:718) at com.android.dx.command.dexer.main.access$1200 (main.java:85) at Com.android.dx.command.dexer.main$filebytesconsumer.processfilebytes (main.java:1645) at Com.android.dx.cf.direct.ClassPathOpener.processArchive (classpathopener.java:284) at Com.android.dx.cf.direct.ClassPathOpener.processOne (classpathopener.java:166) at Com.android.dx.cf.direct.ClassPathOpener.process (classpathopener.java:144) at Com.android.dx.command.dexer.Main.processOne (main.java:672) at Com.android.dx.command.dexer.Main.processAllFiles (main.java:569) at Com.android.dx.command.dexer.Main.runMultiDex (main.java:366) at Com.android.dx.command.dexer.Main.run (main.java:275) at Com.android.dx.command.dexer.Main.main (main.java:245) at Com.android.dx.command.Main.main (main.java:106): Transformclasseswithdexfordebug FAILED: Transformclasseswithdexfordebug (Thread[main,5,main]) completed. Took 5 mins 2.571 secs. Failure:build failed with a exception.* what went wrong:execution failed for task ': Transformclasseswithdexfordebug ' .> com.android.build.api.transform.TransformException: Com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:Process ' Command '/ G3an/ci/jdk1.7.0_79/bin/java "finished with Non-zero exit value" Try:run with--STACKTRACE option to get the Stack trac E. Run with--DEBUG option to get more log output.
Cause: Gradle stack Memory overflow during compilation
Solution: Add in the Build.gradle configuration file
dexoptions {        javamaxheapsize "2g"    
2g indicates memory size, the 32-bit JDK maximum does not seem to exceed 3g, the maximum allowable memory size will be reported the following error
Successfully started process ' command '/g3an/ci/jdk1.7.0_79/bin/java ' Invalid maximum heap size:-xmx4gthe specified Size exceeds the maximum representable size. Error:could not create the Java Virtual machine.error:a fatal exception have occurred. Program would exit.
Q2:
Unexpected top-level ERROR:java.lang.OutOfMemoryError:GC overhead limit exceeded:transformclasseswithdexfordebug Failed:transformclasseswithdexfordebug (Thread[main,5,main]) completed. Took 1 mins 58.823 secs. Failure:build failed with a exception.* what went wrong:execution failed for task ': Transformclasseswithdexfordebug '. ; Com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException: Org.gradle.process.internal.ExecException:Process ' command '/g3an/ci/jdk1.7.0_79/bin/java ' finished with Non-zero Exit value Try:run with--STACKTRACE option to get the stack trace. Run with--DEBUG option to get more log output.
Cause: The memory space of the JVM virtual machine is too small
Solution: Specify the size of the JVM space used at compile time in the Gradle.properties file in the user directory Gradle

File path:/home/[user]/.gradle/wrapper/gradle.properties

Added in file: org.gradle.jvmargs=-xmx2048m

Android Gradle Packaging FAQs and Solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.