2

When I try to create signed APK from My Android Studio I get this error:

:app:dexRelease
AGPBI: {"kind":"simple","text":"UNEXPECTED TOP-LEVEL ERROR:","sources":[{}]}
AGPBI: {"kind":"simple","text":"java.lang.OutOfMemoryError: GC overhead limit exceeded","sources":[{}]}
Bloodied
  • 992
  • 7
  • 19
N P
  • 105
  • 1
  • 1
  • 5

2 Answers2

4

With the limited information you have provided what I can assume is that you area facing OOM exception when building. you can use

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}

in your app gradle file. This should be inside your android {//blah blah }

Give this a shot. Cheers!!!

rakesh kashyap
  • 1,302
  • 19
  • 38
0

I have the same error

build.gradle

defaultConfig {

    multiDexEnabled true
}

in your Application

 @Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    //for multiDex  64k
    MultiDex.install(this);
}


add proguard

#suppresses "Ignoring InnerClasses attribute for an anonymous inner class" warning
-keepattributes EnclosingMethod

if has , and you need

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}
ayac3j
  • 81
  • 6