This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 44187 - Build error when Proguard or MultiDex options are enabled
Summary: Build error when Proguard or MultiDex options are enabled
Status: ASSIGNED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: 7.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
: 53242 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-12 12:41 UTC by Leon
Modified: 2017-04-27 10:26 UTC (History)
17 users (show)

See Also:
Tags: XATriaged
Is this bug a regression?: ---
Last known good build:


Attachments

Description Leon 2016-09-12 12:41:58 UTC
Whenever the Multidex or Proguard option are enabled in a Xamarin.Android 7.0 project (using Java JDK 1.8) the following error appears during the build process, indicating a Java version mismatch:

>Error: 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))) [CREATEMULTIDEXMAINDEXCLASSLIST]

The Proguard jar bundled with the Android SDK (<sdk-folder/tools/proguard/lib) hasn't been updated since 2011 since Proguard is now handled by the gradle plugin of Android Studio in Java based Android development. This outdated version of Proguard doesn't support Java 8.

Seems the mainDexClasses.bat script in the Android SDK build tools calls this outdated bundled Proguard jar and  therefore breaks whenever it is used to handle projects using Java 8 (e.g. Xamarin.Android 7.0 projects)

A temporary solution is to download the latest version of Proguard ( https://sourceforge.net/projects/proguard/files/proguard/ ) and copy the contents of the zip to the <android-sdk-folder>/tools/proguard folder
Comment 1 Atsushi Eno 2016-09-13 04:02:59 UTC
It is being handled at https://github.com/xamarin/xamarin-android/pull/209
Comment 2 Jon Douglas 2016-09-16 19:44:13 UTC
I have a Stack Overflow answer out there to help those who run into this:

http://stackoverflow.com/questions/39514518/xamarin-android-proguard-unsupported-class-version-number-52-0/39514706#39514706
Comment 3 Laurent Dutrillaux 2016-11-14 11:09:33 UTC
I have the same issue, not yet solved.
https://github.com/xamarin/xamarin-android/pull/267
Did this merge will be included to the next Xamarin.Android release ?
Comment 4 softlion 2016-11-21 20:11:12 UTC
Bug still in Xamarin Android v7.1.0.2
Comment 5 klark 2016-11-29 07:41:03 UTC
I had download and replace the latest version of Proguard(5.3.1),but it still not work!
Comment 6 softlion 2016-11-29 08:25:55 UTC
It does work. Check the android sdk folder you are using.
Comment 7 klark 2016-12-01 01:25:35 UTC
Thanks,clean and rebuild,id does work!
Comment 8 Brendan Zagaeski 2017-04-12 18:59:49 UTC
*** Bug 53242 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.