Mumphus
Mumphus

Reputation: 333

Building signed APK of release build fails but debug succeeds. Missing class

When going to build the signed APK for my app if I select the debug build it compiles fine, but when I choose the release build it sits on

:app:transformClassesAndResourcesWithR8ForRelease

and it says

Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded

as well as

AGPBI: {"kind":"warning","text":"Missing class android.arch.paging.PositionalDataSource","sources":[{}],"tool":"D8"}

I have tried adding to my build.gradle(module)

dexOptions{
    javaMaxHeapSize "8g"
}

as well as adding some ignoring to the proguard.cfg

NOTE: I am using MacOS if that might have anything to do with it

Upvotes: 1

Views: 1130

Answers (2)

DanMan
DanMan

Reputation: 1053

I had the same issue with the same stack trace. In my case, there were missing org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=1024m -XX:MaxMetaspaceSize=1g -Dkotlin.daemon.jvm.options="-Xmx1g" configs in the gradle.propertis file.

Upvotes: 0

FunkSoulBrother
FunkSoulBrother

Reputation: 2167

Proguard (which is turned on by default for release builds if I'm not mistaken) should be used very carefully.

ANY code that uses reflection might stop working if obfuscated so if you do want to use Proguard - you need to determine which classes are to be used with reflection and exclude (keep as is ) them.

More info here : https://www.guardsquare.com/en/products/proguard/manual/examples.

Good luck.

Upvotes: 1

Related Questions