-1

After the migration of my project from Android 6.0 to Android 7.0 I get an error while building:

/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.0.1-3/lib/xbuild-frameworks/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)))

The only solution I find online is to upgrade Java to 1.8 but the current version is Java SE Development Kit 8u112.

Any suggestion?

P.S.: Xamarin Android Studio 6.1.1 Build 17 on Mac OS Sierra

Ziba Leah
  • 2,484
  • 7
  • 41
  • 60
  • 2
    Did you update your JDK to 1.8? Make sure to uninstall any old versions of JDK as well or set your `JAVA_HOME` export correctly. Double check the current java version via `java -version` in a Terminal – Jon Douglas Nov 02 '16 at 20:08

1 Answers1

0

On the Xamarin Web Site I found the answer I was looking for:

Note: Xamarin.Android 7.0 requires JDK 1.8 to use the Android Nougat (API 24) APIs. You can continue to use earlier versions of the JDK if targeting earlier Android API levels:

JDK 1.8 - up to API 24+

JDK 1.7 - up to API 23

JDK 1.6 - up to API 20

Additionally, a 64-bit version of the JDK is required to use custom controls in the Android designer.

The simplest option is to install the 64-bit version of JDK 1.8 since it is backwards compatible with all of the previous API levels and supports the new Android designer features.

(One unfortunate complication with JDK 1.8 is that is not compatible with the outdated version of Proguard that is included in the Android SDK. Currently this will cause an error "Unsupported class version number [52.0]" when attempting to use the Proguard or Multidex features in Xamarin.Android. See 44187.)

In other words, DISABLE MULTIDEX and PROGUARD

https://developer.xamarin.com/releases/android/xamarin.android_7/xamarin.android_7.0/#Xamarin.Android_7.0.-1

Ziba Leah
  • 2,484
  • 7
  • 41
  • 60
  • As far as Proguard is concerned, build the Facebook version with Java v8 and replace the one in your android-sdk with the Facebook one: https://github.com/facebook/proguard – SushiHangover Nov 02 '16 at 20:26
  • http://stackoverflow.com/questions/39514518/xamarin-android-proguard-unsupported-class-version-number-52-0/39514706#39514706 – Jon Douglas Nov 02 '16 at 20:36