sirrah
05/09/2019, 9:05 AMinvoke
method of that lambda is abstract.Lambda
and FunctionN
. So one of my lambdas gets translated to this:
new Lambda(success)
{
public final void invoke()
{ MyAccessory.access$getModule$p(this.this$0).disconnect(success, failure);
}
}
With details depending on the exact input arguments and captured variables for the specific lambda.
But ProGuard mangles it to this:
static final class e
extends Lambda
implements Function1<MyError, Unit>
{
e(MyAccessory myAccessory, Function0 paramFunction0, Function1 paramFunction1)
{
super();
}
}
Note that the invoke method is missing entirely.-dontshrink
and -dontobfuscate
to the rules the first version is generated and the code will work. If I disable either the second version is generated and the code fails.
Since I do want to obfuscate the code I'm looking for more specific rules to keep the lambdas intact. I'm trying rules like these but they don't seem to have any effect:
-keep class kotlin.jvm.internal.Lambda { *; }
-keep class * extends kotlin.jvm.internal.Lambda { *; }
-keep class kotlin.coroutines.jvm.internal.SuspendLambda { *; }
-keep class * extends kotlin.coroutines.jvm.internal.SuspendLambda { *; }
-keepclassmembers class * extends kotlin.jvm.internal.Lambda {
*;
}
-keepclassmembers class * extends kotlin.coroutines.jvm.internal.SuspendLambda {
*;
}
-keepclassmembers class kotlin.jvm.internal.Lambda {
*;
}
-keepclassmembers class kotlin.coroutines.jvm.internal.SuspendLambda {
*;
}
This is for a jvm library project where I'm applying ProGuard (v6.0.3) manually. So it's not directly related to Android but I figured there is a good chance someone here knows more about ProGuard than I do.