IllegalArgumentExc: Stack size negative after instruction [] invokestatic
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
Hey guys, here another "IlleagalState: negative stack" exception when preparing for apk release.
Optimizing (pass 2/5)...
Unexpected error while computing stack sizes:
Class = [OUR_INTERNAL_CLASS]
Method = [doResume(Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;]
Exception = [java.lang.IllegalArgumentException] (Stack size becomes negative after instruction [282] invokestatic #52 in [OUR_INTERNAL_CLASS$1.doResume(Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;])
Warning: Exception while processing task java.io.IOException: java.lang.IllegalArgumentException: Stack size becomes negative after instruction [282] invokestatic #52 in [OUR_INTERNAL_CLASS$1.doResume(Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;]
Thread(Tasks limiter_2): destruction
I could find many results around the JobSupport Class causing the crash but this looks different.
Tried to:
export with Proguard 6.0.1, 6.0.2, 6.0.3
-keep class kotlin.coroutines.experimental.* { ; }
Something to consider: in this specific class, we use coroutines in a function within a kotlin object.
update: transforming the Kotlin object to a class fixes the problem
I meet the same problem too.I don't know why proguard will throw this exception and feel that the bytecode is good.
here is bytecode of the class