Quick Links

Adding Xamarin.GooglePlayServices.Base causes project to explode

I am trying to get Firebase Notifications working, and I imagine a North Korean prison would be more fun.

I got the FCMNotifications app working.

My project is next. My dependencies look like this:

It is strange that Xamarin.GooglePlayService libs are showing up, because NuGet doesn't see them. Given the opportunity, Nuget will offer to install (not uninstall).

After adding/installing Xamarin.GooglePlayServices.Base to the project and trying to run I get this bizarre error:

No idea how to fix that.

I also noticed that NuGet asks for permission to install 3 libraries, but only Xamarin.GooglePlayServices.Base actually got added to my .csproj file. When I look at References it looks like all 3 are there. Close and open VS, and then References shows a LOT of problems with bad references.

I tried adding Tasks and Basement to the project (after exiting VS, removing bin/obj folders) manually. No luck. Only makes VS think none of the Xamarin.Android libraries are installed.

Best Answer

Answers

There's a bit of confusion in your project, as some of the libraries are added twice. Such as Xamarin.Android.Support.v7.RenderScript ...
Have you manually added the DLL file and then used NuGet to install it again? The package added by NuGet will have a icon.
When you want to add the Xamarin.GooglePlayServices.Base it shows uninstalling button in the NuGet because the library in your reference is not installed by NuGet.

I also noticed that NuGet asks for permission to install 3 libraries

Yes, it will. Xamarin.GooglePlayServices.Base has other two dependent libraries called Xamarin.GooglePlayServices.Tasks and Xamarin.GooglePlayServices.Basement which also needs to be installed.
It seems the issue is you are calling a none defined method called zzz from your screenshot. I recommend you to optimize your project's references and test again. Or you could try these packages following this documentation on a blank app to see the effect.

The References view makes no sense to me either. I have got the project working but References still shows it can't find many libraries. I did not manually add any DLLs, only used NuGet. I don't know why some icons have 2 black boxes, and why some icons are blue (almost) square with white circles, and a blue dot. Odd icon.

Anyway, I copied my project, only the essential files onto another computer and was able to build and run it there. Then I copied it back to my work computer and the project is building/running again (but only after deleting obj/bin folders, again). My guess is that there was something in the .vs folder that was causing the problem, fixed by deleting the .vs folder. Just a guess.

Oh, have not got FCM working yet, but do have google-services.json and play services included. Now that my project builds/runs again next step is to see if FCM will run... wish me luck.