I ran into an issue of not able to initialize main class with the following error:
Error: Unable to initialize main class com.cepheid.testsupporttool.core.TSTApplication
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 32
Exception Details:
Location:
com/cepheid/testsupporttool/core/TSTApplication.main([Ljava/lang/String;)V @2: getstatic
Reason:
Expected stackmap frame at this location.
…
I have the following obfuscation rules applied:
dontskipnonpubliclibraryclassmembers
dontshrink
dontoptimize
dontpreverify
dontnote
dontwarn
// Keep - Native method names. Keep all native class/method names.
keepclasseswithmembernames includedescriptorclasses: true, 'class * { \
native <methods>; \
}'
// Keep - main class entry
keep 'public class com.mycorp.testsupporttool.core.TSTApplication { \
public static void main(java.lang.String[]); \
}'
In my case, the main class is in a jar with internal libs obfuscated and external jars not obfuscated.
Different error(s) are running into after removing dontpreverify rule:
12:33:22.343 [main] ERROR com.mycorp.startup - unable to start ConfigService
java.lang.NullPointerException: Cannot invoke “com.mycorp.c.i.b.s.a(com.mycorp.c.i.b.e)” because “” is null
at com.mycorp.c.h.e.i(Unknown Source) ~[nexus-3.3.11-RELEASE.jar:11]
at com.mycorp.c.h.e.b(Unknown Source) [nexus-3.3.11-RELEASE.jar:11]
at com.mycorp.c.h.t.b(Unknown Source) [nexus-3.3.11-RELEASE.jar:11]
at com.mycorp.gxcore.e.b.A.b(Unknown Source) [gxcore-3.3.13-RELEASE.jar:3.3.13-RELEASE]
at com.mycorp.myApp.core.TSTApplication.main(Unknown Source) [myApp.jar:?]