1

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?

Community
  • 1
  • 1
Hamed Ghadirian
  • 6,159
  • 7
  • 48
  • 67

1 Answers1

0

After a few hours and testing project on some other systems, I found that I should update Android studio to

Android Studio 2.2 stable version

and also update:

Android Plugin version to 2.2.0
Gradle Version to 2.14.1

And after that gradle console show a warning that gradle heap size is low, you should increase that by adding:

org.gradle.jvmargs=-Xmx1536M

to the gradle.properties file in your project. and now my project run without any problem.

Hamed Ghadirian
  • 6,159
  • 7
  • 48
  • 67