Xamarin.Android - Java Binding depends on Google Play Services

1.8k Views Asked by At

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?

1

There are 1 best solutions below

3
On BEST ANSWER

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.