47

Basicly I'm super newbie and started internship in IT company. I installed VS with Xamarin. The problem that I'm facing is very frustrating. So even when i create empty project I can't compile it and get error like this :

Severity Code Description Project File Line Suppression State Warning major version 52 is newer than 51, the highest major version supported by this compiler.

I searched all over google and asked so many people and still no fix of my problem. If anybody can help me via skype or teamwiever i will APPRECIATE so much. My skype: toniterdal , feel free to add me.

Rob Lyndon
  • 12,089
  • 5
  • 49
  • 74
T.Gelev
  • 499
  • 1
  • 4
  • 4

11 Answers11

63

I was having the same issue, and tearing my hair out. I had the JDK Version 8 installed, but these warnings wouldn't go away, and eventually they generated a build-breaking error.

When I went to Tools -> Options -> Xamarin, and looked at the Android Settings, the Java Development Kit Location was pointing to jdk.1.7.xxxx, in Program Files (x86).

I changed it to 1.8.0_101, in Program Files. Then I restarted Visual Studio, and the same error happened again. Somehow, Visual Studio was detecting Version 7 of the JDK and pointing it to that automatically.

So the solution turned out to be very simple. As well as installing Version 8 of the JDK, UNINSTALL Version 7 of the JDK. As soon as I did that, Xamarin turned out to be much better behaved. This step solved a whole bunch of seemingly unrelated problems.

enter image description here

Rob Lyndon
  • 12,089
  • 5
  • 49
  • 74
29

That error is telling you that the Java Class version that is being loaded was compiled with Java 8 (52) but Java 7 (51) is trying to load that compiled class.

  • Java 7 uses major version 51

  • Java 8 uses major version 52

Check which Java version(s) are installed on your machine and review Xamarin's requirements and Java installation steps (linked below)

Installing the Java SDK (JDK)

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
11

For people having problems with setting the appropriate JDK version, you might want to try to override this setting in the vs2015 options dialog:

Cross Platform Dialog

Stefan
  • 17,448
  • 11
  • 60
  • 79
  • worked great.. Save from big headache. can you share few lines about this answer (If possible).. – Ranjithkumar Aug 24 '16 at 11:32
  • Actually I spend several hours "trail and error" various settings. When I stumbled upon this one, all seemed to work out but I haven't done a in depth analysis. But it seems that the setting for the C++ cross platform settings interfere with the Xamarin ones – Stefan Aug 25 '16 at 10:49
6

Delete bin folder and obj folder and run the project it will be work fine

Bido
  • 61
  • 1
  • 3
3

You have a bad proguard.jar file, you need to replace this .jar by a correct version. The steps below describing how to do that. Some colleagues had the same problem here.

  • Go to Preferences => SDK locations and copy the Android SDK location.
  • Go to that folder (mostly /Users/USERNAME/Library/Developer/Xamarin/android-sdk-macosx) and go to the folder tools/proguard/lib.
  • Here you find a proguard.jar.
  • Rename this to proguard_OLD.jar.
  • Download the last proguard file (like this one https://sourceforge.net/projects/proguard/files/)
  • Unzip and place the proguard.jar in the tools/proguard/lib folder
  • Rebuild your Project

Everything should be fixed!

You can find more info about the bug here:

Robin Bruneel
  • 1,063
  • 8
  • 22
2

For me worked to change the SDK as well, but under Options->Xamarin->Android Settings, I don't have Cross Platform in Options for VS 2015Pro

Kaloyan Penov
  • 81
  • 1
  • 3
2

Note for Windows 64 bit users, the JDK has to be the x86 version not the x64 version.

E.g. C:\Program Files (x86)\Java\jdk1.8.0_111

Greg Barlow
  • 198
  • 11
1

Kaloyan you can find the setting for the Java SKD under Tools->Options and the click on Xamarin in the Options list, then select Android Settings. I installed the latest Java version (8.0.111) and then did a clean on my project and it runs fine now with no errors. Thank you everyone for your posts!

1

In my case, i had to reinstall the JDK 8 (the last version) because other versions JDK 7 couldnt work even with new projects or clean up projects, and also i had to do a clean install of the android sdk.

1

This is how I solved the same issue I faced today:

From Control Panel > Uninstall a Program > uninstall the older Java versions which are on your system. You should only have Jdk 1.8 and Jre 1.8 on your system.

Now go to C:/Program Files/Java and delete all older java versions. If you have setup your JDK 1.8 and JRE 8 in C:/Program Files (x86)/Java then cut paste them into C:/Program Files/Java folder.

Then I restarted IntelliJ IDE which I am using. It automatically asked to update the path of SDK. Update the path to point to Jdk 1.8 and then I recompiled my files and things started working well.

Hope it works for you too!

Murtuza K
  • 165
  • 2
  • 10
0

In my case, I had just deleted .class files and worked fine.