3

We are working on a project which includes lot of new code being developed in terms of multiple sdk's (Being developed in-house) and when we started integrating the new code changes coming along with the sdk's developed by the teams we are getting below error:

minifyReleaseWithR8
WARNING:: R8: Missing class: org.conscrypt.ConscryptHostnameVerifier
WARNING:: R8: Missing class: com.bun.miitmdid.interfaces.IIdentifierListener
ERROR:: R8: java.lang.OutOfMemoryError: GC overhead limit exceeded

The thing to be noted is this is happening while creating build from our CI pipeline and works perfectly on our local machines. Have visited multiple posts mentioning the changes to be done in jvm memory options. Below are the properties we have defined in "gradle.properties" and "build.gradle".

Gradle daemon config

org.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 
android.useAndroidX=true
android.enableJetifier=true

We have tried all the combinations by increasing and decreasing the values for "org.gradle.jvmargs" and "MaxPermSize" but no success.

android {
    //Other configs
    dexOptions {
            javaMaxHeapSize "4g"
        }
    }

We have even tried increasing the CI runner configration from 8GB RAM to 16GB RAM (4core) but still no success.

AndroidDev
  • 41
  • 3
  • 1
    Running R8 on large inputs can require a large heap space. Normally 16GB should be sufficient, and `org.gradle.jvmargs=-Xmx16G -Dfile.encoding=UTF-8` should work. Are you using a different configuration locally vs. on CI? One option is to try to run without a Gradle Daemin on CI (running the Gradle build with `--no-daemon`). You could also try to add `-verbose:gc`, to `org.gradle.jvmargs` see how the java VM GC progresses. – sgjesse Mar 09 '22 at 07:37
  • @sgjesse tried both "org.gradle.jvmargs=-Xmx16G -Dfile.encoding=UTF-8" and "--no-daemon" but its not working. Any idea why ? – AndroidDev Mar 11 '22 at 10:07
  • 1
    Could it be that the CI machines does not have that much memory, so raising it does not matter? Try to add `-Xms16G`, as that should allocate the 16 GB up front. Did you try `-verbose:gc`, as that should also log the amount of memory used for each GC. – sgjesse Mar 14 '22 at 08:12

0 Answers0