2

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.
Community
  • 1
  • 1
Boanerge
  • 369
  • 2
  • 15
  • Are you using hosted build agent? – Eddie Chen - MSFT Jan 24 '17 at 06:34
  • 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 descriptive – Boanerge Jan 25 '17 at 19:44
  • 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 Jan 25 '17 at 19:53

2 Answers2

1

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

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
  • That's what I did. If I leave the JDK 7 the project fail before reaching the point of compiling proguard and when I select JDK 8 then it fails trying to compile Proguard. It was the same on my computer, the diference there is that in my computer I can replace the android SDK that xamarin installs, but in VSTS I cannot do it. – Boanerge Jan 10 '17 at 14:43
  • @Boanerge Do you mean it still throws the same error if using JDK 8? Provide the detail error message here. (The error message in your original post is too simple) – starian chen-MSFT Jan 16 '17 at 07:00
  • I made some modifications to the project, let me roll it back so I can repoduce the error again... – Boanerge Jan 20 '17 at 21:58
1

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.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60