Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Gradle Issue: OutOfMemoryError: PermGen space

After several hours of fighting to get an older project imported from Eclipse to use Gradle and into Android Studio v0.1.3...what I've gotten to now is I can actually do the build on the command line, but when I do Build/Rebuild Project in Studio I get:

Gradle:   FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':EpicMix'. > Failed to notify project evaluation listener.    > A problem occurred configuring project ':facebook'.       > Failed to notify project evaluation listener.          > java.lang.OutOfMemoryError: PermGen space 

It's not a HUGE project, there's a few small sub-projects (including Facebook), so I don't think it really is memory. I just can't figure out what this is...

like image 451
ZaBlanc Avatar asked Jun 09 '13 18:06

ZaBlanc


People also ask

What causes PermGen space error?

lang. OutOfMemoryError: PermGen Space is a runtime error in Java which occurs when the permanent generation (PermGen) area in memory is exhausted. The PermGen area of the Java heap is used to store metadata such as class declarations, methods and object arrays.

How do I fix out of memory error in Android Studio?

If you haven't yet encountered an OOM in your Android application, you will in the near future. Memory leaks cause the OutOfMemoryError in Android. To eliminate the OutOfMemoryError, you must first eliminate memory leaks from your Android application. The Error!

What went wrong out of memory Java heap space gradle?

OutOfMemoryError issues occur either in the compile phase of your project or the test phase of your project while building your Gradle project. If the error occurs during compilation, you must increase heap size thus according to your system capacity and use the following lines of code in Linux and Windows.


2 Answers

For those of you running gradle from the command line, create a gradle.properties file, put it in the root of your project, and add the following:

org.gradle.jvmargs=-XX:MaxPermSize=512m 
like image 65
Karim Varela Avatar answered Oct 14 '22 08:10

Karim Varela


The size of the PermGen space can be increased within Android Studio under File > Settings > Compiler. Look for the setting named "Additional compiler process VM options". Just add the following parameter:

-XX:MaxPermSize=512M 

The default value is 92M. Use G if you want to specify a value in gigabytes.

like image 25
sorenhk Avatar answered Oct 14 '22 10:10

sorenhk