System.MissingMethodException: Method 'Android.Gms.Common.Zze.IsGooglePlayServicesAvailable' not found.
Closed this issue · 9 comments
Reproduction steps:
- Fresh clone of repo
- On
SampleApp.Droid
, upgradeXamarin.Android.Support.*
to 26.1.0.1 (current latest) - On
SampleApp.Droid
, upgradeXamarin.GooglePlayServices.*
to 60.1142.0 (current latest)
There may be some other minor dependencies. I also had to resolve a mscorlib
reference.
Once you start the SampleApp.Droid
, it will crash in MainActivity
on UnifiedMap.Init (this, bundle);
If you comment out int resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(Context);
and replace it with something like int resultCode = 0;
, the error will go away.
Hi teamtam,
UnifiedMap.Droid
and the app SampleApp.Droid
must have the same version of the play services library.
Currently that is 42.1021.1
Also, i found that manually removing bin
and obj
folders sometimes helps after updating/changing dependencies
Thanks for your response @veryhumble
Yes after making sure UnifiedMap.Droid
and SampleApp.Droid
use the same version of the play services library, the sample app runs correctly. It also seems fine when using the latest NuGet package instead of referencing the project. (Aside: gee I wish VS for Mac would let you upgrade/consolidate packages like the Windows version!)
However, allow me to explain the original problem which led me to try to reproduce the problem. My production app runs correctly against 1.8.1 of the NuGet package. However, when I try to use 1.9.0, that is when I get the same exception.
According to NuGet dependencies, UnifiedMaps just requires Xamarin.GooglePlayServices.Maps (>= 32.961.0) ... can you confirm this? Do you have any other suggestions as to why I am experiencing this problem and cannot seem to upgrade to 1.9.0? The only package version discrepancy I currently have in my solution is Newtonsoft.Json, which I assume is unrelated.
Cheers.
You are using Version 32.961.0
in your App?
I guess that seems to be the issue. We found that only if the play services dependecies are the same then it works.
That the NuGet is still requiring 32.961.0
is actually a mistake. I will make an update and set it to the same version that is used by the assemblies.
I know it's not optimal, having to use the exact version on the project. But I don't really know how to fix that in a backward/future proof way.
To clarify, the combinations we have used in our app are:
Previously working before any upgrades:
- Xamarin.Android.Support 25.4.0.2
- GooglePlayServices 32.961.0
- UnifiedMaps 1.7.2
Causes runtime exception in UnifiedMap.Init()
:
- Xamarin.Android.Support 26.1.0.1
- GooglePlayServices 60.1142.0
- UnifiedMaps 1.9.0
Currently seems to work in beta:
- Xamarin.Android.Support 26.1.0.1
- GooglePlayServices 60.1142.0
- UnifiedMaps 1.8.1 (latest I could get to work)
If indeed consumers of UnifiedMaps need to use the same version of Google Play Services as UnifiedMaps was built with, perhaps you could do major point releases to keep in step with Google Play Services?
From 1.8.1 to 1.9.0 I updated google services dependencies because on our project I got the exception on upgrading to > 32.961.0
.
We discussed that too, increase the major version on UnifiedMaps, but came to the conclusion that we should not signal major changes even though the API stays the same.
Do you need to use GooglePlayServices 60.1142.0?
UnifiedMaps will definetly be upgraded to that version too. But I don't have a timeline for that right now.
Hi @veryhumble ... just touching base about this again. Just wondering what the latest timeline is to support GooglePlayServices 60.1142.0? We need to use it in order to upgrade to Android 8.
Hi @teamtam,
I'll try to include this for the next version. Hopefully finishing it by the end of this week.
@teamtam if you can, it would be helpful if you can also test that it works correctly with your app.
Use the branch https://github.com/fiveninedigital/UnifiedMaps/tree/update-forms-and-googleplay-dependencies
and build it in VisualStudio or somewhere and build the NuGet Package from commandline:
./build.sh --target NuGet-Pack
Hi @veryhumble, sorry for the slow response. I wasn't able to quickly test it in our app as we weren't ready to go to Xamarin.Forms 3. I have just tried it out locally for myself and it seems ok so far. Thank you!