Yesterday when I changed my android project gradle file to use java 8 features:
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Every thing was fine. I used lambda expressions and run the project.
But today, I don't know what happen with my project(I reset master to that "upgrading project to use java 8 features" commit). I can't build project. after more than 5 mins android studio shows me an error in gradle console:
Exception in thread "Tasks limiter_1" java.lang.OutOfMemoryError: GC overhead limit exceeded
and it stuck in
:app:compileDebugJavaWithJack
I noticed that a new file created "java_pid25702.hprof" which is very huge(about 1.5 gb).
I'm using Android studio 2.2, java version "1.8.0_51", Mac book pro (core i7, 16gb ram), OS X version 10.11.4
I also changed my android studio "studio.vmoptions" :
-Xms2048m
-Xmx4096m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops
I see these posts: Error java.lang.OutOfMemoryError: GC overhead limit exceeded , Gradle build hanging when jackOptions is enabled for Java 1.8 but none them helps me.
My question is 1-why my project works correctly yesterday, but not tody??! 2-what should I do?