Porting from ProGuard 5

I want to upgrade my toolchain. I have an old project based on gradle 4.8 and proguard 5.0.
So I upgraded to latest and greatest (7.3.2). And it doesn’t work as expected.
The latest version of proguard is 5.3.3 that still produces valid app. Above that final jar is not working and crashes. Something incompatible has been done in releases 6+?

Here are the options. (I tried without mergeinterfacesaggressively too.)

task proguard2(type: proguard.gradle.ProGuardTask, dependsOn : '_build') {
    injars tmp_jar
    outjars out_jar

    libraryjars LTC65ix
    libraryjars LTC65i

    optimizationpasses 8

    keep 'public class * extends javax.microedition.midlet.MIDlet'

    keep 'public class * implements fi.aplicom.a1.system.at.IAtCommand'
    keep 'public class * implements fi.aplicom.a1.system.utils.IConnector'

    keep 'public class  mobile.ResourceFactory*'
    keep 'public class * extends mobile.ResourceFactory* { *; }'
    dontnote "java.**"
    dontnote "javax.**"
    dontnote "com.sun.**"

This is the output

D [2024-01-05T09:56:23Z] [COP] ev.POS,SYS,

java.lang.Error: 137

 - fi.aplicom.a1.system.cop.CopV1Driver.readGeneralStatus(), bci=589

 - fi.aplicom.a1.system.cop.CopV1Driver.readGeneralStatus(), bci=10

 - fi.aplicom.a1.system.Sysw.initialize$1385ff(), bci=894

 - mobile.Main.run(), bci=252

 - java.lang.Thread.run(), bci=5


This is a memory issue. Have you already tried adding some memory to Gradle jvm args like -Xmx ?

The output is from running midlet.

I just fond out that it works without optimizations.

this is my current conf:



It makes sense. Optimizations can consume a lot of memory. It is possible that changes were made that require more memory in the new Proguard versions. If you’re not ok with disabling optimisations, you can try increasing the heap space (-Xmx) as mentioned before.

It is not a gradle memory problem. error occurs at runtime on actual device. One of the optimizations creates a faulty output.
Version 6 introduced something that is not backward compatible and now I have 20% larger output compared to v5.

I would suggest to try to narrow down the problem by disabling individual optimizations (ProGuard Manual: Optimizations | Guardsquare)
You can also try enabling aggressive optimizations as this is not default anymore, using -optimizeaggressively