I am getting java.lang.OutOfMemoryError at app startup i.e Splash Activity, when building release APK with latest dexguard version 9.1.13.
java.lang.OutOfMemoryError: Failed to allocate a 574109856 byte allocation with 938429 free bytes and 253MB until OOM, target footprint 3753717, growth limit 268435456 at com.paymax.mfs.subscriber._AppController.onCreate(Unknown Source:131) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1242) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7218) at android.app.ActivityThread.access$1500(ActivityThread.java:269) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2166) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8218) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
following are the dexguard setting in build.gradle(app-level)
dexguard {
overwriteUnprotected = true
path = 'path\\DexGuard-9.1.13'
license = 'path\\DexGuard-9.1.13\\lib\\dexguard-license.txt'
configurations {
release {
defaultConfiguration 'dexguard-release-aggressive.pro'
configuration 'dexguard-project.txt'
configuration 'proguard-rules.pro'
defaultConfiguration 'dexguard-rasp.pro'
}
}
}
After a lot of struggle, I came to conclusion that this error was caused due to Certificate Temper detection feature in Dex-guard. We have to add SHA-256 hash inside Dex-guard rules.