2

所以,我试图让 ADT 的内置 proguard 实现适用于我的应用程序。不幸的是,它似乎对我引用的第三方库中的各种类感到窒息。我已经尝试了各种(如果不是全部)我能想到的 -libraryjars 和 -keep 公共类行的组合,但这一切都不好。我对 Proguard 没有那么丰富的经验,所以老实说,我不知道我哪里出错了。我试过谷歌,但大部分信息都与 Ant 脚本有关。

我尝试过的一些事情:

  • 文件顶部或底部的 -libraryjars C:\Users\Dave\workspace\Dropbox_Sync_for_Tasker_and_Locale\lib\apache-mime4j-0.6.jar 等行

  • 试图相对地创建通往罐子的路径的线路,根本没有成功。

  • 像 -keep public class org.apache.commons.logging.LogFactory 这样的行

  • 引用错误行的另一部分的行,例如 -keep public class org.apache.james.mime4j.field.MailboxListField

无论如何,错误日志是一堵巨大的文字墙,所以我把它放在了一个 pastebin here上。

4

3 回答 3

3

所以,如果你碰巧找到了这个答案,并且就像,嗯,我也有这个问题,我希望他发布他的解决方案,你有一半的运气。

我修复它的方法是将 -libraryjars 行粘贴在那里,然后

-dontwarn org.apache.commons.logging.LogFactory
-dontwarn net.jcip.annotations.NotThreadSafe
-dontwarn net.jcip.annotations.ThreadSafe
-dontwarn net.jcip.annotations.Immutable

它工作得很好。这是一个黑客,它很脏,但它为我解决了它。不幸的是,如果你也有这个问题,你仍然需要靠自己。

于 2011-02-09T21:57:13.633 回答
3

I had exactly the same problem after adding "apache-mime4j-0.6.1.jar" and "httpmime-4.0.1.jar" to my project. (for multipart POST'ing of binary data to my server).

I am also not familiar with pro-guard but at least I've managed to add my custom widget to the proguard.cfg - unfortunately the apache library proved even more difficult to add !

this is my fix... I have this added to the bottom of proguard.cfg :

#APACHE LIBRARY
-libraryjars /libs/apache-mime4j-0.6.1.jar
-libraryjars /libs/httpmime-4.0.1.jar
-keepnames class org.apache.** {*;}
-keep public class org.apache.** {*;}
-dontwarn org.apache.commons.logging.LogFactory
-dontwarn org.apache.http.annotation.ThreadSafe
-dontwarn org.apache.http.annotation.Immutable
-dontwarn org.apache.http.annotation.NotThreadSafe

I was hoping that the first 4 lines would be the fix. Unfortunately the dontwarn's are needed to really "fix" it.

Correct me if I am wrong (since I'm no proGuard pro), but I believe the first 4 lines make sure that the libraries are used as-is. The second section of four lines (dontwarn) just cover up the remaining crap and don't correct some underlying issue. What the underlying issue is I don't know.

于 2011-05-30T01:16:06.657 回答
0

尝试下载commons-logging.jar,将其放入您的库中并添加-libraryjars到您的 proguard 配置中。

于 2011-02-01T23:13:46.340 回答