Reputation: 557
I have installed the Xamarin.GooglePlayServices.Base nuget package into my existing Xamarin.Android application. Since then, it fails to build with the following error message:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error: error XA4212: Type Android.Support.V4.App.JobIntentService/JobServiceEngineImpl
implements Android.Runtime.IJavaObject
but does not inherit Java.Lang.Object
or Java.Lang.Throwable
. This is not supported. (Happimeter.Watch.Droid).
My question: how do I fix this error?
EDIT 1: The following packages have been added as a result of installing the nuget package:
Successfully installed 'Xamarin.GooglePlayServices.Location 60.1142.1' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.GooglePlayServices.Base 60.1142.1' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.GooglePlayServices.Tasks 60.1142.1' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.GooglePlayServices.Basement 60.1142.1' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.Build.Download 0.4.9' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.Android.Support.Fragment 26.0.2' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.Android.Support.Media.Compat 26.0.2' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.Android.Support.Core.Utils 26.0.2' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.Android.Support.Core.UI 26.0.2' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.Android.Support.Compat 26.0.2' to Happimeter.Watch.Droid
Successfully installed 'Xamarin.Android.Support.Annotations 26.0.2' to Happimeter.Watch.Droid
EDIT 2:
This is my setup:
Visual Studio Community 2017 for Mac
Version 7.3.3 (build 5)
Runtime:
Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 504010007
=== Xamarin.Android ===
Version: 8.1.3.0 (Visual Studio Community)
Android SDK: /Users/mariusstein/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
7.1 (API level 25)
SDK Tools Version: 25.2.3
SDK Platform Tools Version: 25.0.1
SDK Build Tools Version: 25.0.1
Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Here is a sample project where you can reproduce the issue:
EDIT 3: As per Build xamarin android project unsucessfully,error XA4212 I a just added
<PropertyGroup>
<!-- Other properties -->
<AndroidErrorOnCustomJavaObject>false</AndroidErrorOnCustomJavaObject>
</PropertyGroup>
This turned the error into a warning. However this solution seems rather unclean. If anyone has a suggestion as to how to fix this issue permanently, I would like to hear it.
EDIT 4: Updating to Android Target API 27 resolved the error/warning.
Upvotes: 0
Views: 1088
Reputation: 2168
The different version of Xamarin.GooglePlayServices.Base is target to different version of android. For example: 60.1142.1 need MonoAndroid,Version=8.0. You could check this in each version's dependencies.
If you are using target api 25, you should use 42.1021.1
Upvotes: 2