Issues with Proguard and obfuscation of Javascript code

40 Views Asked by At

In my android app I have a part that is a webview that send the application some javascript code. And the obfuscation when I build for release is not listening to me :( My proguard is looking like this:

-keepclassmembers class * {
  @android.webkit.JavascriptInterface <methods>;
}
-keepattributes *JavascriptInterface*

-keep public class com.myPackage.MapFragment$JavascriptCallback
-keep public class * implements com.myPackage.MapFragment$JavascriptCallback
-keepclassmembers class com.myPackage.MapFragment$JavascriptCallback {
   <methods>;
}

And my class looks like this:

class MapFragment() {

@JavascriptInterface
inner class JavascriptCallback{
    fun postMessage() {
        
    }
 }
}

I also have tried with an independent class, but is not working. I'm about to disable the minifying.

0

There are 0 best solutions below