After Updating to 0.1.3 Build fails with java.lang.OutOfMemoryError

4521 views
Skip to first unread message

Kevin Smith

unread,
Jun 7, 2013, 11:33:57 AM6/7/13
to adt...@googlegroups.com
My project was building perfectly before updating but now I get this error.

Gradle: 
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':App'.
> Failed to notify project evaluation listener.
   > java.lang.OutOfMemoryError: PermGen space
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Is there something I need to change in my gradle files to be compatible with 0.1.3?

Thanks

Kevin Smith

unread,
Jun 7, 2013, 11:36:18 AM6/7/13
to adt...@googlegroups.com
I should note that it still builds from the command line. The error only occurs in Android Studio.

Xavier Ducrohet

unread,
Jun 7, 2013, 1:10:34 PM6/7/13
to adt...@googlegroups.com
Does it happen on every build?

When building from studio, the Gradle tooling API makes the build use the Gradle daemon, that is reuse for every build. I've seen some message on the gradle mailing lists that there may be a leak right now in it.

However when you build from the command line, the daemon is not used by default so you won't see the same issue (you could still run out of memory but that would be a different problem).

I always use the daemon when compiling from the command line (for performance reason), and I do run out of memory every now and then, but looking at the dumped hprof file it seems to be due to the daemon keeping in memory many version of the Gradle plugin (because I change the version all the time when working on it), so I haven't found that too weird.

Do you have the hprof file that was dumped when you encountered the error? (I have no idea where it would be generated).


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Matt Kranzler

unread,
Jun 7, 2013, 1:59:29 PM6/7/13
to adt...@googlegroups.com
I'm also having this issue. Builds fine from command line, Android Studio will not build it due to a PermGen space OOM error. I tried increasing the permgen size in the .vmoptions file with no success.

Traun Leyden

unread,
Jun 7, 2013, 2:18:12 PM6/7/13
to adt...@googlegroups.com
I was getting those errors too, and my workaround was to modify the gradlew script:

Before:

GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""

After:

GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\" \"-Xmx1024m\" \"-Xms256m\" \"-XX:MaxPermSize=1024m\""

Initially I'd set the MaxPermSize to 512m, which was working for a while, and then one time I got another memory error and bumped it up to 1024m.  Since then I haven't gotten any.

If there's a cleaner way I'd be curious to hear about it..




--

Matt Kranzler

unread,
Jun 7, 2013, 4:46:33 PM6/7/13
to adt...@googlegroups.com
I tried this as well and mine still doesn't build. I have a lot of library projects and jars, but this seems like a bug since it shouldn't need that much space to build.

Kevin Smith

unread,
Jun 7, 2013, 4:48:41 PM6/7/13
to adt...@googlegroups.com
Using Traun Leyden modifications to GRADLE_OPTS I still got the same error. I upped the 1024m to 2048m and now I get a different error.

org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.

Kevin Smith

unread,
Jun 10, 2013, 8:09:14 AM6/10/13
to adt...@googlegroups.com
Not sure why but this resolved itself.

Patrick Boos

unread,
Jun 12, 2013, 3:56:22 AM6/12/13
to adt...@googlegroups.com
I am pretty sure this is the daemon. Just ran into the same problem:
- OutOfMemory when building in Android Studio (even restart of Android Studio did not help)
- Building in console worked fine

$ ps ax | grep gradle
 5181   ??  S      6:35.69 /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/bin/java -Dfile.encoding=x-MacRoman -cp /Users/boos_patrick/.gradle/wrapper/dists/gradle-1.6-bin/72srdo3a5eb3bic159kar72vok/gradle-1.6/lib/gradle-launcher-1.6.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.6 /Users/boos_patrick/.gradle/daemon 10800000 985baa4a-8795-4549-bbb0-23d150dc1394 -Dfile.encoding=x-MacRoman
 6102 s003  R+     0:00.00 grep gradle
$ kill 5181

Hope this helps some others. I like this way better than raising XX:MaxPermSize.

=> build works again in Android Studio ;-)

Scott Battaglia

unread,
Jun 28, 2013, 3:31:27 PM6/28/13
to adt...@googlegroups.com
Were people able to resolve this?  I'm still experiencing this in Android Studio AI-130.725679 (the latest version as of this writing).

Steps taken to attempt to mitigate:

1. Modify idea.vmoptions to increase heap and permgen (I tried permgens of 512m, 1024m, and I think even 1500m). [no affect, set back to normal]
2. Add a Gradle wrapper and set this: DEFAULT_JVM_OPTS="-Xmx4072m -Xms512m -XX:MaxPermSize=2048m -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled" (I've tried various values for all of these parameters) [doesn't seem to be working]

This thing builds from the command line quite well.

Thanks
Scott
Reply all
Reply to author
Forward
0 new messages