Android Studio Gradle Issue: OutOfMemoryError: PermGen space

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

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.