Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to limit DEX memory usage

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 619
    Comment on it

    Sometimes we are getting errors of shortage of memory at the compile time.


    We get such type of error:

    Exception in thread "pool-1-thread-2" Exception in thread "pool-1-thread-3"
    Exception in thread "pool-1-thread-4" java.lang.OutOfMemoryError: GC overhead limit exceeded

    So as to limit or exceed Dex memory usage, we need to set the dexOptions.javaMaxHeapSize configuration to whatever value we need.
    The default javaMaxHeapSize appears to be a little over 1 GB.

    Below is the code that we need to add in the gradle file

    dexOptions {
            javaMaxHeapSize "4g"
        }

    We can also speed up by turning on incremental dexing like this

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }


    Hope it will help you.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: