Smack 4.1 的推荐 ProGuard 规则是什么?
What are the recommended ProGuard rules for Smack 4.1?
在构建 Android 发布 apk 时,Smack 4.1 的正确 ProGuard 规则是什么?
目前,我正在使用 aSmack 4 中的规则。0.x 来自 aSmack github 存储库上的 README.asmack 文件,该文件已过时(引用旧 class名称,并用于 4.0.x)。我找不到任何关于适用于 4.1.x 的正确混淆器规则的参考,任何人都可以阐明这一点吗?
What are the proper Proguard rules for Smack 4.1 when building an
Android release apk?
取决于 "proper" 对您意味着什么。
最简单的方法可能是 tell ProGuard to keep all classes and interfaces 的 Smack。
-keep class org.jivesoftware.smack.** { *; }
-keep class org.jivesoftware.smackx.** { *; }
或者,您可以配置 ProGuard,使其仅保留您实际使用的 Smack 部分,而让 ProGuard 剥离其他所有内容。但要这样做,您需要很好地了解您的应用程序如何使用 Smack。参见例如 MAXS 的 Transport XMPP 的 ProGuard 配置:https://bitbucket.org/projectmaxs/maxs/src/75efeba8d8470b89da8cd8551304bb00648e4945/transport-xmpp/proguard-project.txt?at=master#cl-20
请注意,如果您不确切地知道自己在做什么,那么 Smack 可能会出现意外行为甚至崩溃。 只有在您知道自己在做什么的情况下才能对 ProGuard 进行微调!
实际上,我的经验表明,如果您还使用 proguard 并启用了 minify,您实际上可能需要额外的一行。如果你得到错误
java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
然后需要以下配置:
-keepattributes Signature
-keep class org.jivesoftware.smack.** { *; }
-keep class org.jivesoftware.smackx.** { *; }
有关详细信息,请参阅:。
在构建 Android 发布 apk 时,Smack 4.1 的正确 ProGuard 规则是什么?
目前,我正在使用 aSmack 4 中的规则。0.x 来自 aSmack github 存储库上的 README.asmack 文件,该文件已过时(引用旧 class名称,并用于 4.0.x)。我找不到任何关于适用于 4.1.x 的正确混淆器规则的参考,任何人都可以阐明这一点吗?
What are the proper Proguard rules for Smack 4.1 when building an Android release apk?
取决于 "proper" 对您意味着什么。
最简单的方法可能是 tell ProGuard to keep all classes and interfaces 的 Smack。
-keep class org.jivesoftware.smack.** { *; }
-keep class org.jivesoftware.smackx.** { *; }
或者,您可以配置 ProGuard,使其仅保留您实际使用的 Smack 部分,而让 ProGuard 剥离其他所有内容。但要这样做,您需要很好地了解您的应用程序如何使用 Smack。参见例如 MAXS 的 Transport XMPP 的 ProGuard 配置:https://bitbucket.org/projectmaxs/maxs/src/75efeba8d8470b89da8cd8551304bb00648e4945/transport-xmpp/proguard-project.txt?at=master#cl-20
请注意,如果您不确切地知道自己在做什么,那么 Smack 可能会出现意外行为甚至崩溃。 只有在您知道自己在做什么的情况下才能对 ProGuard 进行微调!
实际上,我的经验表明,如果您还使用 proguard 并启用了 minify,您实际上可能需要额外的一行。如果你得到错误
java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
然后需要以下配置:
-keepattributes Signature
-keep class org.jivesoftware.smack.** { *; }
-keep class org.jivesoftware.smackx.** { *; }
有关详细信息,请参阅: