I've posted a couple of times on the phonegap forum about this, but I haven't got any response, so I hope maybe someone here can help me.
First off, I know that ProGuard does not obfuscate the js and html in a PhoneGap app. My app has a significant amount of native code as well, so I'm trying to follow Google's publishing checklist and add obfuscation. I'll provide links to my earlier posts at the end for anyone who wants more detail, so I'll try to keep this short. My app runs fine when built without ProGuard, but when I enable ProGuard, I can't even get it to build without a ton of warnings, and those warnings cause the build to fail. I can get the build to finish only if I use a directive to ignore warnings. But then the resulting .apk does not work. What seems to be the case is that the *deviceready* event is never delivered to the Phonegap *WebView* -- at least the javascript listener appears to never get it. In an attempt to narrow down the cause, I created an unmodified PhoneGap sample project, and found essentially the same behavior. Building the sample app unmodified produces: [2013-06-11 16:19:23 - HelloPhoneGap_280] Proguard returned with error code 1. See console [2013-06-11 16:19:23 - HelloPhoneGap_280] Note: there were 86 duplicate class definitions. [2013-06-11 16:19:23 - HelloPhoneGap_280] Warning: org.apache.cordova.CordovaWebView$Level16Apis: can't find referenced method 'void setAllowUniversalAccessFromFileURLs(boolean)' in class android.webkit.WebSettings [2013-06-11 16:19:23 - HelloPhoneGap_280] Warning: org.apache.cordova.ExposedJsApi: can't find referenced class android.webkit.JavascriptInterface [2013-06-11 16:19:23 - HelloPhoneGap_280] Warning: org.apache.cordova.ExposedJsApi: can't find referenced class android.webkit.JavascriptInterface [2013-06-11 16:19:23 - HelloPhoneGap_280] Warning: org.apache.cordova.ExposedJsApi: can't find referenced class android.webkit.JavascriptInterface [2013-06-11 16:19:23 - .... I found this advice<https://groups.google.com/forum/?fromgroups#!topic/phonegap/8U4amn2NSBs>, which says to add the directives -keep public class * extends com.phonegap.api.Plugin -keep public class org.apache.cordova.DroidGap -keep public class org.apache.cordova.** -libraryjars /PathToYourCommensCodecJar/commons-codec.jar -dontwarn android.webkit.* Doing this does allow the build to complete, but I think the only line that does anything is the last one saying to ignore warnings. (If I take that line out, everything is as before.) And the resulting .apk, built with ProGuard warnings suppressed, does not work, as I said above. Does anyone here know enough about ProGuard to help me make some progress? As a start, can someone explain why adding the directive -keep public class android.webkit.** has no effect on the warnings? By my understanding of ProGuard syntax, it should fix them all. Any ideas appreciated at this point. Andrew Here are links to my posts on the phonegap forum, which may provide additional information. https://groups.google.com/forum/#!topic/phonegap/JF4N4dHoAoI https://groups.google.com/forum/#!topic/phonegap/R36T9D7B4ps -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.