Recently, I've run into OutOfMemoryError: PermGen space issue when building Gradle projects, especially with Kotlin.
A common way to fix that is to increase the heap size for Gradle JVM, like adding org.gradle.jvmargs=-XX:MaxPermSize=512m to grade.properties.
Actually, there's another simple way to fix the issue