1

We use several different types of Ad networks that we have to write our own Java bindings for. Since Google has made a new "advertising" id, all these libraries now have a dependency on Google Play Services.

The problem is, I can't get these binding projects to build properly after getting their latest versions. I get an error about missing classes, unless adding google-play-services.jar (from my extras folder in my Android SDK) as a Reference Jar to the project.

Once the play services jar file is added, I get a new error:

missing class error was raised while reflecting com.somepackage.SomeClass : com/google/android/gms/common/GooglePlayServicesRepairableException : Unsupported major.minor version 51.0 JARTOXML

This error generally means the library is using Java 7 (not supported by Xamarin) from what I've read. What can I do to fix these binding projects?

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182

1 Answers1

9

The problem is that Xamarin uses JDK 1.6 when your library was compiled with JDK 1.7.

In order to work around this, first install JDK 1.7 32-bit. Then in the Progrm Files (x86)\Java folder, rename the jdk1.6 folder to _jdk1.6.

When Xamarin runs it will now find the JDK 1.7 folder and use that. So far I haven't had any issues building apps with Xamarin and JDK 1.7.

Hope this helps.

Kiliman
  • 18,460
  • 3
  • 39
  • 38
  • I'd switch back to Java 1.6 in Xamarin Studio / Visual Studio after you finish with your binding.You could run into some oddities in the future as Xamarin doesn't officially support java 1.7. – Chuck Pinkert May 29 '15 at 00:16
  • 2
    Actually, that's no longer true. Xamarin supports JDK 1.7 see http://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/#Installing_Java_SDK_(JDK) In fact, it is required to support API level 21+. – Kiliman May 29 '15 at 22:16
  • Freakin' thanks mate :D You saved me a huge headache ! – Ethenyl Jun 03 '15 at 11:20