The Xamarin.Android and ProGuard issue
So from time to time, one would get some cryptic messages when trying to run an app on a physical device. They seem daunting at the beginning, but do not dispair; help is on the way!
The shock
I recently tried deploying a Xamarin.Android app to my side device, and to my surprise, got this error.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 10.
Output: Error: Can’t read [/Library/Frameworks/Xamarin.Android.framework/Versions/7.2.0–7/lib/xbuild-frameworks/MonoAndroid/v7.1/mono.android.jar]
(Can’t process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))
(My.AppName.Droid)
So, now what?
- Let’s start where we developers should always start: Google!
The answer
From the horse’s mouth:
If you are trying to use ProGuard against Android 7.0 or later, you must download a newer version of ProGuard because the Android SDK does not ship a new version that is compatible with JDK 1.8.
The solution
Follow the instructions in the following Stack Overflow answer, which involves:
- Downloading the latest version of ProGuard.
2. Replace the old version of ProGuard, typically located in /Users/[MyUser]/Library/Developer/Xamarin/android-sdk-macosx/tools/proguard with the folder you downloaded.