我想用ProGuard優化/混淆Java項目。 我從eclipse中將該項目解壓縮爲一個可運行jar,並且運行得很好。未能用ProGuard混淆Java代碼
當我嘗試使用ProGuard壓縮它,我得到數以千計的警告和錯誤的,特別是在最後:
Note: there were 1 classes trying to access generic signatures using reflection.
You should consider keeping the signature attributes
(using '-keepattributes Signature').
Note: there were 14 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
Note: there were 2 class casts of dynamically created class instances.
You might consider explicitly keeping the mentioned classes and/or
their implementations (using '-keep').
Note: there were 15 accesses to class members by means of introspection.
You should consider explicitly keeping the mentioned class members
(using '-keep' or '-keepclassmembers').
Warning: there were 13229 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
Warning: there were 61 instances of library classes depending on program classes.
You must avoid such dependencies, since the program classes will
be processed, while the library classes will remain unchanged.
Warning: there were 18 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
我在項目中使用的外部庫是在出口它入瓶中從日食。 (「將所需的庫提取到jar中」)。我沒有使用「重新裝入罐子」選項,因爲它確實減慢了瓶子的放置。
特別的庫是:
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
難道我fondamentally錯在這裏做什麼?
我已經試過沒有成功的proguard的建議,我的代碼編譯在eclipse中沒有任何警告。
這是一個非常大的項目,所以我不能真正提供一個MCVE,但如果有人能指出我在正確的方向在這裏,我失去了什麼,我真的很感激它。
警告的例子:(它繼續爲每一個方法)
顯然,這可能是過於籠統的問題爲你們解決,但是我可能會做一些重大明顯我沒有意識到的錯誤,這就是我要做的。