java.lang.OutOfMemoryError: GC overhead limit exceeded on Android 1.4

后端 未结 7 1346
庸人自扰
庸人自扰 2020-12-03 02:26

I get an java.lang.OutOfMemoryError: GC overhead limit exceeded when run gradle on Android 1.4 ... these are my depedencies :

dependencies {         


        
相关标签:
7条回答
  • 2020-12-03 03:08

    This worked for me !! Just add the following lines into "gradle.properties" file

    org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError
    org.gradle.daemon=true
    org.gradle.parallel=true
    org.gradle.configureondemand=true
    
    0 讨论(0)
  • 2020-12-03 03:09

    Add this to your android closure(build gradle):

     dexOptions {
            javaMaxHeapSize "4g"
     }
    

    This will solve your problem. Still, if you face problem see the following link

    GC overhead limit exceeded error

    0 讨论(0)
  • 2020-12-03 03:09

    In my case, OutOfMemoryError is come from this error. Starting a Gradle Daemon, 1 busy and 6 stopped Daemons could not be reused, use --status for details

    To solve this. I use ./gradlew --stop or ./gradle --stop. If still not solved which mean the gradle process is lock (this happen after OutOfMemoryError).

    Go to /users/[username]/.gradle/daemon (hidden) folder.

    You will see each built gradle version folder like 3.2 3.3 4.0.1 4.1 4.10.1 4.10.2 4.4 4.6 5.4.1 5.5

    Go into these folders and remove the file named

    registry.bin

    registry.bin.lock

    For me, I remove all these folders.

    Then rebuild you app. Should be work now.

    0 讨论(0)
  • 2020-12-03 03:20

    This is what I suggest:

    Add this to your "gradle.properties" file:

    org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError
    

    Also, read this article. You might be able to make the building a bit faster, by adding a combination of those:

    org.gradle.daemon=true
    org.gradle.parallel=true
    org.gradle.configureondemand=true
    
    0 讨论(0)
  • 2020-12-03 03:20

    My test were failing in gradle version 5.2.1 "GC overhead limit exceeded java.lang.OutOfMemoryError: GC overhead limit exceeded". I solved by adding maxHeapSize in build.gradle like below:

     test {
            maxHeapSize = "4g"
        }
    
    0 讨论(0)
  • 2020-12-03 03:22

    just go to prefrence or settings -> memori settings -> and setup your alocated memory

    android studio 3.5

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