2
votes

I have a Xamarin Forms Project that I'm trying to integrate with HockeyApps using Continuous Integration with VSTS. My app compiles using Java 1.8 and it uses ProGuard to shrink the android apk file. But when java try to compile the application, it finds that the Installed version of proguard is not compatible with Java 1.8 The error is the following: ... Can't process class [android/app/ActivityTracker.class] Unsupported class version number [52.0] maximum 51.0, Java 1.7... In my local visual studio installation, I fixed it replacing the default proguard version that Xamarin Installs for the lastest one 5.x...

Anybody knows how to do it with VSTS?

DETAILED ERROR:

_CompileToDalvikWithDx:
  C:\Program Files\Java\jdk1.8.0_102\\bin\java.exe -jar C:\java\androidsdk\android-sdk\tools\proguard\lib\proguard.jar -include C:\java\androidsdk\android-sdk\tools\proguard\proguard-android.txt -include obj\Release\proguard\proguard_xamarin.cfg -include obj\Release\proguard\proguard_project_references.cfg -include obj\Release\proguard\proguard_project_primary.cfg -include proguard.cfg "-injars 'obj\Release\proguard\__proguard_input__.jar';'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\mono.android.jar';'obj\Release\__library_projects__\FormsViewGroup\library_project_imports\formsviewgroup.jar';'obj\Release\__library_projects__\HockeySDK.AndroidBindings\library_project_imports\bin\classes.jar';'C:\Users\buildguest\AppData\Local\Xamarin\Xamarin.Android.Support.Animated.Vector.Drawable\23.3.0.0\embedded\classes.jar';'C:\Users\buildguest\AppData\Local\Xamarin\Xamarin.Android.Support.Design\23.3.0.0\embedded\classes.jar';'C:\Users\buildguest\AppData\Local\Xamarin\Xamarin.Android...
  java.io.IOException: Can't read [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\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
  Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF8
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2025,3): Error MSB6006: "java.exe" exited with code 1.
2
Are you using hosted build agent?Eddie Chen - MSFT
Yes, and the detailed error error message that I added to the question just shows when I set the system.debug variable to true, if I don't, then the error is a lot less descriptiveBoanerge
I just updated Xamarin for visual studio and proguard started failing again in my PC, I checked and found that xamarin updated proguard again from the newer version (~5.2) to the older version (4.7)Boanerge

2 Answers

1
votes

I'm afraid that there isn't any workaround for your issue with Hosted Build Agent since the user has no permission to update the installed software on Hosted Machine.

You need to deploy your own build agent and then replace the files manually.

1
votes

The reason is that it uses JDK 1.7 that is incompatible. You can specify JDK version of Xamarin build step:

enter image description here