建议的Smack 4.1 ProGuard规则是什么? [英] What are the recommended ProGuard rules for Smack 4.1?

查看:112
本文介绍了建议的Smack 4.1 ProGuard规则是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建Android版本apk时,适用于Smack 4.1的ProGuard规则是什么?

What are the proper ProGuard rules for Smack 4.1 when building an Android release apk?

当前,我正在使用aSmack github存储库上的README.asmack文件中来自aSmack 4.0.x的规则,该规则已过时(引用旧的类名,并且适用于4.0.x).我找不到任何有关4.1.x使用的适当Proguard规则的参考,有人可以阐明吗?

Currently, I'm using the rules from aSmack 4.0.x from the README.asmack file on the aSmack github repository which is outdated (references old class names, and intended for 4.0.x). I could not find any references to what the proper proguard rules to use for 4.1.x are, could anyone shed light on this?

推荐答案

构建Smack 4.1时,正确的Proguard规则是什么? Android版本的APK?

What are the proper Proguard rules for Smack 4.1 when building an Android release apk?

取决于正确"对您的含义.

Depends on what "proper" means for you.

最简单的方法可能是告诉ProGuard保留所有类和接口 Smack.

The easiest way is likely to tell ProGuard to keep all classes and interfaces of Smack.

-keep class org.jivesoftware.smack.** { *; }
-keep class org.jivesoftware.smackx.** { *; }

或者,您可以配置ProGuard,使其仅保留您实际使用的Smack的那些部分,然后让ProGuard剥离其他所有内容.但要这样做,您需要很好地了解您的应用程序如何使用Smack.例如,请参阅MAXS传输XMPP的ProGuard配置: https://bitbucket.org/projectmaxs/maxs/src/75efeba8d8470b89da8cd8551304bb00648e4945/transport-xmpp/proguard-project.txt?at=master#cl-20

Alternatively you can configure ProGuard so that it only keeps those parts of Smack that you actually use, and let ProGuard strip everything else. But to do so, you'll need a good understanding how your App uses Smack. See for example the ProGuard configuration of MAXS's Transport XMPP: https://bitbucket.org/projectmaxs/maxs/src/75efeba8d8470b89da8cd8551304bb00648e4945/transport-xmpp/proguard-project.txt?at=master#cl-20

请注意,如果您不确切知道自己在做什么,那么Smack可能会表现异常,甚至崩溃.如果您知道自己在做什么,请仅对ProGuard进行微调!

Note that if you don't know exactly what are you doing, then Smack could behave unexpectedly or even crash. Only fine tune ProGuard if you know what you are doing!

这篇关于建议的Smack 4.1 ProGuard规则是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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