I’m trying to add proguard for my sdk project and I have a suspend methods in my sdk package. suspend methods signature change like this when I enabled proguard.
Java decompile code
@Nullable
public final Object getVideosAsync(@NotNull xxx.Params var1, @NotNull Function1<? super Pair<xxx, ? extends List<Error>>, Unit> var2, @NotNull Continuation<? super Unit> var3) {
...
my sdk kotlin code:
suspend fun getVideosAsync(
params: xxx.Params = xxx.Params(),
onReceived: (Pair<xxx?, List<xxx>?>) -> Unit
) {
if (XXXInjection.isInitialized().not()) return
val response = XXXInjection.provideVideoRepository().getVideos(params)
onReceived(response)
}
I tried to fix by adding some rules for continuation problem like below.
1- -keep Signature
2- -keep class kotlin.Metadata
3- -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
But I could not prevent the Continuation parameter from being added to the suspend methods, so when I try to call the suspend methods, it asks me for the Continuation parameter and this is ridiculous. I wonder if this decompiles into java code or is there a method to decompile it into kotlin code? So, Proguard should obfuscate Kotlin code from Kotlin, is this possible? So I thought suspend methods would work properly?