PhoneGap的2.4 Android的Proguard的配置 [英] Phonegap 2.4 Android Proguard config

查看:114
本文介绍了PhoneGap的2.4 Android的Proguard的配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经升级,从PhoneGap的(科尔多瓦)构建2.0〜2.4,一切工作正常的开发,直到我真正来到测试最终版本的apk。什么我发现,很多时间都浪费之后,是由于某种原因,现在当我运行构建我ProGuard的配置,那么破的PhoneGap构建以某种方式这意味着它运行时的deviceready永远不会被调用。似乎有建筑的时候,也没有运行并没有什么,据我可以看到,但我猜东西在科尔多瓦JS被悄悄未按我没有变编译/设备上登录错误没有错误。

I've upgraded a build from Phonegap (Cordova) 2.0 to 2.4 and everything was working fine in dev until I actually came to testing the final release apk. What I'm finding, after a lot of time wasted, is that for some reason now when I run the build my proguard config is breaking the phonegap build in some way that means that when it runs the deviceready is never called. There seem to be no errors when building, nor running and nothing as far as I can see but I'm guessing something is silently failing in the cordova js as i'm not getting compile / log errors on the device.

正如我说的,这只是当已经跑在构建过程Proguard的obfs。如果我关掉Proguard的这一切工作正常。我恢复了我的所有code回到2.0,以确保这是所有精做的地方,一路上一直存在就是貌似不是记录了的Stüble变化/或没有人打,只是还没有(2.4才出来几个星期前 - 在写2013年2月26日)的时间

As I say this is ONLY when having ran the Proguard obfs in the build process. If i turn off Proguard it all works fine. I reverted all my code back to 2.0 to be sure and that is all fine so somewhere along the way there has been a stuble change that is seemingly not documented / or nobody has hit just yet (2.4 only came out a few weeks ago - at time of writing 26th feb 2013).

我的Proguard的配置包含以下内容的PhoneGap(以及一些其他的标准配置)

My Proguard config contains the following for phonegap (as well as some other standard config)

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

和反编译的DEX似乎并没有抛出任何光线 - 一切看起来确定一目了然......

and decompiling the dex doesn't seem to throw any light - everything looks ok at a glance...

任何人有什么想法?

推荐答案

尝试更换科尔多瓦保持设置中你的ProGuard-project.txt与下面的行,这应该对所有科尔多瓦类,字段和方法,既公共和私人(并因此重新启用deviceready):

Try replacing the Cordova "keep" settings in your proguard-project.txt with the following line, which should maintain all Cordova classes, fields, and methods, both public and private (and thus reenable deviceready):

-keep类org.apache.cordova ** {*。 }

-keep class org.apache.cordova.** { *; }

然后你只需要包括您的类(ES)(presumably延伸CordovaPlugin,而不仅仅是插件)例如:

Then you just need to include your class(es) (presumably extending CordovaPlugin, not just Plugin) e.g.

pre-V3:

-keep public class * extends org.apache.cordova.api.CordovaPlugin

V3 +:

v3+:

-keep public class * extends org.apache.cordova.CordovaPlugin

这篇关于PhoneGap的2.4 Android的Proguard的配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆