Question

When I test my app on the device using Run as --> Android Application, Phonegap functionality works fine.

When I export a .apk file using Eclipse and run it on the device, Phonegap functionality is not working. I assume it's likely a Proguard issue. How do I solve this?

proguard-properties.txt

-keep public class * extends com.phonegap.api.Plugin
-keep public class * extends org.apache.cordova.api.Plugin
-keep public class org.apache.cordova.DroidGap
-keep public class org.apache.cordova.**
-libraryjars /path/to/adt-bundle-mac/sdk/tools/lib/commons-codec-1.4.jar
-dontwarn android.webkit.*
Was it helpful?

Solution

This worked:

-keep public class * extends com.phonegap.api.Plugin
-keep public class * extends org.apache.cordova.api.Plugin
-keep public class org.apache.cordova.DroidGap
-keep public class org.apache.cordova.**
-keep public class org.apache.**
-dontwarn android.webkit.*
-dontwarn org.apache.**
-keep public class * extends org.apache.cordova.api.CordovaPlugin
-keep class org.apache.cordova.** { *; }

(Phonegap 2.4 Android Proguard config)

OTHER TIPS

I used : -keep class org.apache.cordova.** { *; } while proguarding my cordova application but it did not work. But when I wrote the same statement after '-keep' statements of all java files then it worked absolutely fine.(It might be because after keep of all cordova functions, keep of java functions overriding and excluding the cordova functions again). But one of my project changing of order did not matter while in one it worked only after the order change i.e., by writing -keep class org.apache.cordova.** { *; } statement at the end in proguard config file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top