Posts

Showing posts from October, 2012

sbt+ProGuard+addJavascriptInterface = HELL!!

Honestly I really don't understand what's going on, but I have been messed with addJavascriptInterface of WebView(android) used on the sbt project which is using ProGuard for obfuscation for weeks (literally!) I have guessed the problem was caused by obfuscating class names so that WebView cannot find the method, however proguard options were too tricky. After try & errors, I finally made it to work adding following setting to Build.scala proguardOption in Android := List( "-keep public class * extends android.app.Fragment", "-keep public class com.test.javaInterface", "-keepclassmembers class com.test.javaInterface { <methods> }" ).mkString(" ") The points are -dontobfuscate seems not working. (for my environment at least.) sbt clean seems to be needed every time I changed proguardOption All options should be combined as one line. not only class but classmembers should avoid obfusca