0

I have a problem with the GC overhead limit.

I encountered this error after I edited the Grade and updated the GooglePlayServices and updated the Android Studios version into 2.1.2

I'm not quite sure why this happened since I have changed next to nothing in my actual program before trying to run. So I am suspecting the source came from the Gradle, though I am not sure if the GC error is a new feature in 2.1.2 or happened because of the update.

The gradle is below for reference (this is the app module, the only gradle file I messed with)

apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "24.0.0" defaultConfig { applicationId "com.example.denny.phonebelt" minSdkVersion 16 targetSdkVersion 24 versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.google.android.gms:play-services:9.2.0' compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.android.support:design:24.0.0' compile 'com.android.support:support-v4:24.0.0' compile 'com.android.support:multidex:1.0.1' compile 'com.google.firebase:firebase-database:9.0.0' compile 'com.google.firebase:firebase-auth:9.0.0' } 

1 Answer 1

4

Please increase your Android studio Gradle plugin heap size. You can add below lines in your gradle.properties file, present in your project directory.

org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m 

EDIT: You can increase 256m to higher values according to requirement(unless you stop getting that GC error).

Sign up to request clarification or add additional context in comments.

3 Comments

I'm concerned to as if the problem is because my heap size is way too small, or because my program has too much garbage. I'll try your method out tomorrow (it's late right now) and I'll get back to you on this. Thanks for the suggestion though!
Well as per information provided, I can see two possible cases: 1. Updating your PlayService has included extra files and might have caused it 2. Earlier version of Android studio was almost on the verge of GC overhead limit but was holding on due to older version of PlayService having less files.
For me ~/.gradle/gradle.properties did not exist but I created it and added org.gradle.jvmargs=-XX\:MaxHeapSize\=2g -Xmx2g. It worked

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.