简体   繁体   中英

Phonegap functionality not working after eclipse apk export - proguard issue?

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.*

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 )

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 ie, by writing -keep class org.apache.cordova.** { *; } statement at the end in proguard config file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM