在尝试使用ProGuard(4.9)对桌面应用程序进行模糊处理和优化时,所有操作都会有效,直到我使用外部库(例如JSoup.connect("http://google.com/").get();
)中的内容。我会收到以下错误:
Exception in thread "Thread-2" java.lang.ExceptionInInitializerError
at org.jsoup.b.l.<clinit>(Unknown Source)
at org.jsoup.b.f.<init>(Unknown Source)
at org.jsoup.b.e.<init>(Unknown Source)
at org.jsoup.c.bh.b(Unknown Source)
at org.jsoup.c.bh.a(Unknown Source)
at org.jsoup.c.b.a(Unknown Source)
at org.jsoup.c.D.a(Unknown Source)
at org.jsoup.a.a.a(Unknown Source)
at org.jsoup.a.i.e(Unknown Source)
at org.jsoup.a.e.a(Unknown Source)
at package.a.a(Unknown Source)
at package.a.b(Unknown Source)
at package.w.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Unknown Source)
at java.util.Properties.load0(Unknown Source)
at java.util.Properties.load(Unknown Source)
at org.jsoup.b.k.d(Unknown Source)
at org.jsoup.b.k.<clinit>(Unknown Source)
... 14 more
我试过寻找解决方案,但答案总是针对Android应用程序。没有运气,我尝试了以下内容:
Use mixed-class names
-keep public enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
最近,使用ProGuard 5.2完成此过程,并未发生太大变化。以下是修复问题的更新过程:
Keep additional class names and class member names
Add...
转到Extends/implements class
并输入与下面示例匹配的图书馆,然后按Ok
。对每个库重复。
org.jsoup.**
org.apache.commons.net.**
org.jdesktop.**
org.google.gson.**
转到“信息”标签。
Skip non-public library class members
Ignore warnings about possibly erroneous input