如何让 Proguard 忽略外部库? [英] How to make Proguard ignore external libraries?
问题描述
我想使用 Proguard 主要是为了混淆.
I want to use Proguard mainly for obfuscation reasons.
我的问题是我有三个库,Twitter4J 和两个路标库.当我尝试创建已签名的 APK 时,这些库会导致错误.为了解决这个问题,我将以下内容放在 proguard.config
文件中...
My problem is that I have three libraries, Twitter4J and two signpost libraries. These libraries caused errors when I tried to create an signed APK. To get over this I put the following in the proguard.config
file...
-dontwarn org.apache.commons.codec.binary.**
-dontwarn org.slf4j.**
-dontwarn com.sun.syndication.io.**
-dontwarn com.sun.syndication.feed.synd.*
虽然这消除了控制台中的错误,但当我将签名的 APK 加载到手机上时,它立即崩溃了.DDMS 表示这是由于在 Twitter4J 中找不到一个类.
While this got rid of the errors in the console, when i loaded my signed APK onto my mobile phone it instantly crashed. The DDMS said this was due to a class not found in Twitter4J.
摆脱上面的 "dontwarns"
没有帮助.添加 dontshrink dontoptimise
也没有.
Getting rid of the "dontwarns"
above did not help. Neither did adding dontshrink dontoptimise
.
我希望 Proguard 完全忽略这些库(因为它们无论如何都是开源的).这可能吗?
I would like Proguard to completely ignore the libraries (as they are open source anyway). Is this possible?
推荐答案
试试这个:
-keep class javax.** { *; }
-keep class org.** { *; }
-keep class twitter4j.** { *; }
来自@CaspNZ 的 Cf 帖子:带有外部 jar 的 Android Proguard
Cf post from @CaspNZ: Android Proguard with external jar
这篇关于如何让 Proguard 忽略外部库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!