Error Proguard Unsupported class version number

2020-02-10 01:29发布

I get always this erroe when I try to obfuscate an App with proguard

Error:ProGuard: [MyApp] java.io.IOException: Can't read [C:\Program Files\Java\jdk1.8.0\jre\lib\rt.jar] (Can't process class [com/oracle/net/Sdp$1.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))

I have already updated Proguard and checked the project-config file but always the same Error. I'm using the latest version of Intellij IDEA

4条回答
Rolldiameter
2楼-- · 2020-02-10 01:51

ProGuard 5.0 (released in August 2014) supports Java 8.

查看更多
Juvenile、少年°
3楼-- · 2020-02-10 02:06

ProGuard has not been updated yet to support Java 8.

An issue has already been raised against ProGuard.

Eric Lafortune (ProGuard developer) noted back in October 2013

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.

He also said

ProGuard probably works on class files that only use older features if you change or disable ClassUtil#checkVersionNumbers.

查看更多
做自己的国王
4楼-- · 2020-02-10 02:08

There is a successor of pyx4me ProGuard Maven plugin on github with support to ProGuard 5.2, hence Java 8 support:

https://github.com/wvengen/proguard-maven-plugin

http://wvengen.github.io/proguard-maven-plugin/

Cheers, Ekho

查看更多
▲ chillily
5楼-- · 2020-02-10 02:09

Seems that Proguard doesn't support Java 8 actually. You have to use JDK version 7.

EDIT-1

I have recompiled Proguard to support JDK 8 classes, doesn't support Java 8 new features but if your code doesn't use Java 8 new syntax(e.g. Lambda Expression) should works without problems. Tested with some android projects.

To use replace the file proguard.jar in

android-sdk\tools\proguard\ 

with the content of THIS ARCHIVE

EDIT-2

Recently has been released the official Proguard 5 that should address the issue. You can download this from HERE

查看更多
登录 后发表回答