简体   繁体   中英

Xamarin - Google Cloud Messaging - error: package com.google.android.gms.iid does not exist

I have been trying to get Google Cloud Messaging working according to Xamarin's example.

All has been going good until I tried to deploy the app with this piece of code:

[Service(Exported = false), IntentFilter(new[] { "com.google.android.gms.iid.InstanceID" })]
    class MyInstanceIDListenerService : InstanceIDListenerService
    {
        public override void OnTokenRefresh()
        {
            var intent = new Intent (this, typeof (RegistrationIntentService));
            StartService (intent);
        }
    }

Then I get an error that reads:

Severity    Code    Description Project File    Line
Error       error: package com.google.android.gms.iid does not exist
    extends com.google.android.gms.iid.InstanceIDListenerService    

and:

Severity    Code    Description Project File    Line
Error       error: cannot find symbol
        if (getClass () == MyInstanceIDListenerService.class)
  symbol:   method getClass()
  location: class MyInstanceIDListenerService

Screenshot:

在此处输入图片说明

I checked my SDK folders to make sure all packages were properly extracted and they are:

在此处输入图片说明

Does this look like a Xamarin bug or is there something wrong on my side?

Actually one of the sdk zip files was corrupted and I had to download it manually and extract it. After hitting "clean and build" the build worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM