I'm trying to use Proguard in my Xamarin.Android project, yet the compilation fails with the error Unsupported class version number [52.0] (maximum 51.0, Java 1.7)
I saw from those two questions that it may be a mismatch between Java 7 and Java 8, more precisely some versions of proguard don't support Java 8. However in Xamarin Preferences -> SDK Location, Java SDK points to JDK 7 : /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Is there any place where proguard can be configured more precisely ? Any other idea ?
Here's the failure log :
java.io.IOException: Can't read [/Library/Frameworks/Xamarin.Android.framework/Versions/7.0.0-18/lib/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar] (Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))) at proguard.InputReader.readInput(InputReader.java:230) at proguard.InputReader.readInput(InputReader.java:200) at proguard.InputReader.readInput(InputReader.java:178) at proguard.InputReader.execute(InputReader.java:78) at proguard.ProGuard.readInput(ProGuard.java:196) at proguard.ProGuard.execute(ProGuard.java:78) at proguard.ProGuard.main(ProGuard.java:492) Caused by: java.io.IOException: Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)) at proguard.io.ClassReader.read(ClassReader.java:112) at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87) at proguard.io.JarReader.read(JarReader.java:65) at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65) at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53) at proguard.InputReader.readInput(InputReader.java:226) ... 6 more Caused by: java.lang.UnsupportedOperationException: Unsupported class version number [52.0] (maximum 51.0, Java 1.7) at proguard.classfile.util.ClassUtil.checkVersionNumbers(ClassUtil.java:140) at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:88) at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) at proguard.io.ClassReader.read(ClassReader.java:91) ... 11 more
9 Warning(s) 1 Error(s)
You need to update the default Android SDK proguard.jar
with the latest version of Proguard found here:
https://sourceforge.net/projects/proguard/files/
I would recommend that you install this on the side of the default version that Android ships in android-sdk\tools\proguard
. Simply rename the existing folder to something else and add the new version of proguard
.
This is listed in the Xamarin.Android 7.0 release notes:
https://developer.xamarin.com/releases/android/xamarin.android_7/xamarin.android_7.0/
In which the following bug was logged as well:
https://bugzilla.xamarin.com/show_bug.cgi?id=44187
Which is coordinated with a Pull Request in the Xamarin.Android repository:
https://github.com/xamarin/xamarin-android/pull/209
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With