1

Previously, Xamarin has been working for me on Windows 10 Version 1511, but then I updated to Windows 10 1607 and Visual Studio kept warning me that there is an update, saying "Xamarin for Visual Studio Update Available." I kept clicking on that, but nothing happened, so finally, I went to Tools -> "Extensions and Updates" and searched for Xamarin, where I downloaded and ran XamarinInstaller.exe. The problem is that my internet cut out part way through so the installation didn't complete, so now when I try to run a Xamarin.Android project, I get this error:

...
1>Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
1>Skipping target "_CreateAdditionalResourceCache" because it has no outputs.
1>C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\java.exe -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\24.0.1\\lib\dx.jar" --no-strict --dex --output=obj\Debug\android\bin obj\Debug\android\bin\classes "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v4.4\mono.android.jar" 
1>java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
1>  at java.lang.ClassLoader.defineClass1(Native Method)
1>  at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
1>  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
1>  at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
1>  at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
1>  at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
1>  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
1>  at java.security.AccessController.doPrivileged(Native Method)
1>  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
1>  at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
1>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
1>  at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
1>  at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
1>Exception in thread "main" 
1>java.lang.UnsupportedClassVersionError: com/android/dx/command/Main  :  Unsupported major.minor version 52.0
1>Done building project "MyProject.Droid.csproj" -- FAILED.
1>Build FAILED.
1>
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

I updated my java from (see Android NDK: Your APP_BUILD_SCRIPT points to an unknown file):

C:\Program Files (x86)\Java\jdk1.7.0_55

To,

C:\Program Files\Java\jdk1.7.0_79

Which fixed the following error,

Severity    Code    Description Project File    Line    Suppression State
Error       java.lang.UnsupportedClassVersionError: com/android/dx/command/Main  :  Unsupported major.minor version 52.0    TuberEduMobile.Droid    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets   2159

But that did not resolve the first issue above. Also, I downloaded android-ndk-r12b, but when I attempt to build using ndk-build, I get this error:

Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: C:\projects\android-ndk-r12b/jni/Android.mk
C:/projects/android-ndk-r12b/build//../build/core/add-application.mk:198: *** Android NDK: Aborting...    .  Stop.

Does anyone have any suggestions? How can I get my Xamarin.Android working again? TIA.

UPDATE:

Thank you for the suggestion, @Alan Clark. Tried uninstalling using the link you indicated and reinstalling Xamarin using XamarinInstaller.exe, and even deleted the old Java jdk1.7.0_55 from my machine, where even if I go to Options -> Xamarin -> Android Settings it says for Java Development Kit Location:

C:\Program Files\Java\Jdk1.7.0_79

but for some reason it is still pointing at that directory old directory, because I am getting this error when I attempt to build my Xamarin.Android solution:

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2159,3): error MSB6004: The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_55\\bin\java.exe" is invalid.

Please note that it is pointing to this NDK:

C:\Program Files\Android\ndk\android-ndk\r11c

Not sure if it is related to my specific problem.

Does anyone have any suggestions? TIA.

user8128167
  • 6,929
  • 6
  • 66
  • 79

2 Answers2

3

Solved problem by changing my JDK to 1.8.0_91 in Options -> Xamarin -> Android Settings -> Java Development Kit Location:

C:\Program Files\Java\jdk1.8.0_91

Also, had to make sure that this file had the correct path to Java JDK:

~\MyProject.Droid\obj\Debug\sdks.cache
user8128167
  • 6,929
  • 6
  • 66
  • 79
1

Under the circumstances, and on the assumption that other components may be broken due to the drop-out, I would recommend a full uninstall and reinstall of Xamarin (and possibly the JDK too if that's causing issues). Please ensure you follow all the steps in the guide to ensure that all traces of Xamarin are removed prior to reinstalling.

Alan Clark
  • 974
  • 7
  • 10
  • +1 Thank you, that was definitely important for helping me troubleshoot the problem so I could uninstall and reinstall Xamarin. – user8128167 Aug 12 '16 at 14:17