如何使Proguard的忽略外部库? [英] How to make Proguard ignore external libraries?

查看:155
本文介绍了如何使Proguard的忽略外部库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用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发布: <一href="http://stackoverflow.com/questions/6870773/android-proguard-with-external-jar/6870844#6870844">Android Proguard的外部罐

Cf post from @CaspNZ: Android Proguard with external jar

这篇关于如何使Proguard的忽略外部库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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