Xamarin.Forms android 应用在添加 "Xamarin.Firebase.Messaging" 后将不再构建

Xamarin.Forms android app won't build anymore after adding "Xamarin.Firebase.Messaging" to it

将 "Xamarin.Firebase.Messaging" 添加到任何 Xamarin.Forms android 应用程序后,由于

,它将不再构建
Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Xamarin.Firebase.Messaging'

有警告

esolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'Xamarin.Firebase.Messaging.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

创建新的 xamarin.forms 项目并通过 nuget 将所述包添加到 .android 应用程序时会发生同样的问题(此处没有错误)。

添加 "Xamarin.GooglePlayServices.Base" 也无济于事。

(因此清理项目、重新安装包、运行 以管理员模式等。不会修复它)

@Nicks 评论解决了问题:

I would suggest try clearing your NuGet cache (Tools > NuGet Package Manager > Clear All NuGet Cache(s)) and then reinstalling the package. I just tried adding Firebase.Messaging to a Xamarin.Forms Android project in VS 2019 and everything was fine