Proguard - any way to ignore incompatible (due to Java bytecode version) packages in external library?

时间:2018-01-23 19:43:55

标签: java windows proguard

I have a desktop Java project (compiled with an older JRE as target). The simplified structure of my .pro file is:

-injars qtt.jar
-outjars qtt_obf.jar
-libraryjars \Libraries\wsp.jar

wsp.jar is offered by a 3rd-party that includes Java 9-specific packages, e.g. META-INF\versions\9\com.xyz.prod\<various_other_folders>. At this time, Java 9 support is not available, hence Proguard complains about the presence of classes with version 53.0.

Is there any way to make Proguard "skip" these external dependencies (and, fo course, not break the application at runtime)?

1 个答案:

答案 0 :(得分:1)

事实证明,过滤器是一个救星:改变你的例子,使其读取

-injars qtt.jar
-outjars qtt_obf.jar
-libraryjars \Libraries\wsp.jar(!META-INF/**) 

将过滤掉META-INF中的所有内容 - 包括您试图摆脱的版本9类文件。请在下面的页面中查看更多详细信息。

https://www.guardsquare.com/proguard/manual/usage#filefilters