How to keep kotlin suspend function return type as kotlin.Pair?

I have class like below. This class is in a API in SDK for Android application.
class temp {
suspend fun test(): Pair<String, Int> {
return Pair(“”, 1)
I want to keep this function, but the return type change to java.lang.Object.
Is there any way to keep this return type as kotlin.Pair?

In my mapping file, it shows that return type is changed.
java.lang.Object test(kotlin.coroutines.Continuation) → test

But when this is not a suspend function, it can keep return type as kotlin.Pair.
Sorry for my poor English.


Welcome the Guardsquare Community! You should first try keeping the entire class with a broad keep rule like the one below:

-keep class my.package.class.** { *; }

Make sure to change the package name to correspond with your own package name. You can use the ProGuard Playground to confirm if this keep rule is effective to the specific class you want to keep. Let me know if this approach works to keep the return type unchanged.

Best Regards,


1 Like