Proguard / MultiDex & Xamarin.Android.7

this is a quick post, actually it won’t be useful for long as a fix is coming from Xamarin, but in case you’ve been fighting with this error

>Error: Can't read [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\] (Can't process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))) [CREATEMULTIDEXMAINDEXCLASSLIST]

here’s the solution:

Basically the problem here is that while Proguard updates are handled by the gradle plugin of Android Studio in Java based Android development in Xamarin we’ve been using the 2011 version shipped with Android SDK. This outdated version of Proguard doesn’t support Java 8.

The fix is really simple, just go here, download last version of Proguard and replace the libs that you have in your Android SDK (<sdk-folder/tools/proguard/lib)

P.s. this error may occur even if you’re not using Proguard but have enabled MultiDex, this is because the mainDexClasses.bat script in the Android SDK calls it.