Bug 46273 - Xamarin GooglePlayService.gcm is no longer registering
Summary: Xamarin GooglePlayService.gcm is no longer registering
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 6.1.1 (C7SR0)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2016-11-01 21:42 UTC by mli
Modified: 2017-06-23 21:58 UTC (History)
4 users (show)

Tags: bb
Is this bug a regression?: ---
Last known good build:


Attachments
Sample project that demonstrate the error. (1.82 MB, application/x-zip-compressed)
2016-11-01 21:42 UTC, mli
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description mli 2016-11-01 21:42:19 UTC
Created attachment 18292 [details]
Sample project that demonstrate the error.

Hi,

I am using both Mac and Windows, with the following info:

Xamarin Studio 6.1.1, 
Xamarin.Android 7.0.1.3 
supports 6.0 (API level 23), 7.0 (API level 24)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 25
SDK Build Tools Version: 25

I am using Xamarin.GooglePlayServices.Gcm version 29.0.0.2 with Xamarin.Android.Support.V4 version 24.2.1. The issue that I am having is Xamarin Gcm registration service no longer registering. The following statement ends up throwing an exception

Statement: "var instanceId = InstanceID.GetInstance(Application.Context);"

Exception: "The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)"

This issue did not exist when I was using Xamarin.Android.Support.V4 version 23.2.1.

I have attached a sample project to demonstrate this issue. You may find the error in the GcmRegistrationService.cs.

Any help would be greatly appreciated.

Thank you very much!
Comment 1 mli 2016-11-01 21:59:19 UTC
Xamarin.Android.Support.V4 version 23.4.0.1 seems to work with Xamarin.GooglePlayServices.Gcm 29.0.0.2
Comment 2 bwegiel 2016-11-08 08:52:01 UTC
The same here.

It also does not work for me with Xamarin.Android.Support.V4 version 23.4.0.1 and Xamarin.GooglePlayServices.Gcm 29.0.0.2.
The same error appears.

Any updates on that?
Comment 3 dj_technohead 2017-01-30 23:36:04 UTC
I'm also running into this. Is there a workaround to get push notifications working at all?
Comment 4 dj_technohead 2017-02-02 03:01:59 UTC
Is anybody taking a look at this issue? I'd imagine anybody that has made the mistake of updating to the latest SDKs and packages will be running into this if they use Google Play Services for push notification. This is a very serious problem for our users.

thanks,
Dennis
Comment 5 mli 2017-02-02 15:10:07 UTC
Hi Dennis,

I was able to resolved this issue by updating to the latest Xamarin.GooglePlayServices.*, which is v32.961.0. If you have the previous version of Xamarin.GooglePlayService.* nuget packages installed. such as version 29.0.0.2, you would have to manually remove those packages (instead of trying to update them). Then you can install the newer version of the Xamarin.GooglePlayService.*. Hopefully after doing all that, you can resolve this issue. :) Good Luck!

Ming
Comment 6 dj_technohead 2017-02-02 19:11:49 UTC
Hi Ming,
   thanks very much for responding.

   I tried that, by deleting the packages folder in the solution's folder, and then updating the packages.config file so that the v32.961.0 nuget packages for GooglePlayServices would be installed upon re-opening the solution. This appeared to work ok, the right nuget packages were downloaded, but when I try to build the solution, it errors out with "The type or namespace 'Gcm' does not exist in the namespace 'Android.Gms'. Are you missing an assembly reference?". It doesn't seem to be able to find anything in the Android.Gms namespace.

   Intellisense shows that Android.Gms.Gcm.Iid does exist. I've made sure that all the android SDKs are up to date. I'm targeting the latest installed platform (7.0) with a minimum Android version of 5.0 (API level 21) and target Android version of 6.0 (API level 23).

 thanks,
Dennis
Comment 7 mli 2017-02-02 19:17:41 UTC
Right! The Android.Gms.Gcm.Iid namespace was updated to the Android.Gms.Iid. Try to replace all the "Android.Gms.Gcm.Iid" namespace(s) to "Android.Gms.Iid", hopefully this should fix the compilation error. Good luck!

Ming
Comment 8 dj_technohead 2017-02-02 21:17:01 UTC
Ah ok! Starting to make some progress, thanks very much! 
Any idea where GcmListenerService is now located?
Comment 9 mli 2017-02-02 21:20:21 UTC
Great to hear! It is under namespace Android.Gms.Gcm. Good luck! :)
Comment 10 dj_technohead 2017-02-02 21:26:53 UTC
Hmm, I no longer have Android.Gms.Gcm as a namespace. I only have Actions, Ads, Common, Dynamic, Iid, Location and Security under Android.Gms.
Comment 11 mli 2017-02-02 21:37:40 UTC
Do you have Xamarin.GooglePlayServices.Gcm nuget package? 

With the new v32.961.0 Xamarin.GooglePlayServices.* nuget packages, you should get:
 - Xamarin.GooglePlayServices.Base
 - Xamarin.GooglePlayServices.Basement
 - Xamarin.GooglePlayServices.Gcm
 - Xamarin.GooglePlayServices.Iid
 - Xamarin.GooglePlayServices.Tasks
Comment 12 dj_technohead 2017-02-02 21:42:35 UTC
Yes, I have those, plus Location and Maps, all version 32.961.0.
Comment 13 dj_technohead 2017-02-02 21:45:56 UTC
Looking at the Assembly Browser, it seems to only see Xamarin.GooglePlayServices.Basement and Xamarin.GooglePlayServices.Iid. That's probably the reason why.
Comment 14 mli 2017-02-02 21:47:58 UTC
Okay! Good luck! :)
Comment 15 dj_technohead 2017-02-02 21:58:55 UTC
Thanks very much for your help Ming. Was in the dark, now I can see the light.
Comment 16 mli 2017-02-02 22:01:35 UTC
Glad to hear. :)