https://kotlinlang.org logo
Title
m

maxmello

03/06/2019, 12:52 PM
Are there examples of how to strip away a top level Kotlin extension function (with default parameter) with proguard? Right now I have the following:
-assumenosideeffects class com.example.package.ExtensionsKt {
    public static void myFunction(...);
}
The function is defined as follows:
fun Any.myFunction(param1: String, param2: Throwable? = null) {
    ...
}
But it does not work sadly, I also tried the following (method signature copied from mapping.txt) which also does not work:
-assumenosideeffects class com.example.package.ExtensionsKt {
     public static void myFunction(java.lang.Object,java.lang.String,java.lang.Throwable);
     public static void myFunction$default(java.lang.Object,java.lang.String,java.lang.Throwable,int,java.lang.Object);
}
t

tseisel

03/06/2019, 4:04 PM
Did you manage to strip any other method using Proguard ? If you don't, maybe you haven't enabled Proguard optimizations. This answer may help : https://stackoverflow.com/a/25280494/8691695
m

maxmello

03/06/2019, 9:53 PM
You are right, I missed putting the proguard-android-optimize.txt inside the getDefaultProguardFile() part, thank you 👍