简体   繁体   English

eclipse apk 导出后,Phonegap 功能不起作用 - proguard 问题?

[英]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.当我使用 Run as --> Android Application 在设备上测试我的应用程序时,Phonegap 功能工作正常。

When I export a .apk file using Eclipse and run it on the device, Phonegap functionality is not working.当我使用 Eclipse 导出 .apk 文件并在设备上运行它时,Phonegap 功能不起作用。 I assume it's likely a Proguard issue.我认为这可能是 Proguard 问题。 How do I solve this?我该如何解决这个问题?

proguard-properties.txt 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 ) Phonegap 2.4 Android Proguard 配置

I used : -keep class org.apache.cordova.** { *;我用过:-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).但是,当我在所有 java 文件的“-keep”语句之后编写相同的语句时,它工作得非常好。(这可能是因为在保留所有cordova函数之后,保留java函数覆盖并再次排除cordova函数)。 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.** { *;但是我的一个项目更改顺序并不重要,而其中一个项目只有在顺序更改后才起作用,即通过编写 -keep class org.apache.cordova.** { *; } statement at the end in proguard config file. } 语句在 proguard 配置文件的末尾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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