Error Proguard Unsupported class version number
当我尝试使用proguard混淆应用程序时,总是会遇到这种错误
1 2 | Error:ProGuard: [MyApp] java.io.IOException: Can't read [C:\\Program Files\\Java\\jdk1.8.0\\jre\\lib\ t.jar] (Can't process class [com/oracle/net/Sdp$1.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))) |
我已经更新了Proguard并检查了项目配置文件,但始终是相同的错误。 我正在使用最新版本的Intellij IDEA
似乎Proguard实际上并不支持Java 8。您必须使用JDK版本7。
编辑1
我重新编译了Proguard以支持JDK 8类,不支持Java 8的新功能,但是如果您的代码不使用Java 8的新语法(例如Lambda Expression),则可以正常工作。经过一些android项目的测试。
要使用,请替换文件proguard.jar
1 | android-sdk\\tools\\proguard\\ |
包含此存档的内容
编辑2
最近已经发布了应该解决该问题的官方Proguard 5。您可以从这里下载
ProGuard 5.0(2014年8月发布)支持Java 8。
ProGuard尚未更新以支持Java 8。
针对ProGuard的问题已经提出。
Eric Lafortune(ProGuard开发人员)在2013年10月提到
I'm very busy at the moment, so realistically I won't be able to complete this in the short term, sorry. I'm keeping an eye on the developments though.
他还说
ProGuard probably works on class files that only use older features if you change or disable ClassUtil#checkVersionNumbers.
github上有一个pyx4me ProGuard Maven插件的后继版,它支持ProGuard 5.2,因此支持Java 8:
https://github.com/wvengen/proguard-maven-plugin
http://wvengen.github.io/proguard-maven-plugin/
干杯,
k