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

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

我一直在努力让 Google 云消息根据 Xamarin's example.

工作

一切顺利,直到我尝试使用这段代码部署应用程序:

[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);
        }
    }

然后我收到一条错误消息:

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

和:

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

截图:

我检查了我的 SDK 文件夹以确保所有包都已正确提取,它们是:

这看起来像是 Xamarin 错误还是我这边有问题?

实际上,其中一个 sdk zip 文件已损坏,我不得不手动下载并解压缩。点击 "clean and build" 后构建工作正常。