You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MAUI.NET 7 Android集成Firebase时google-services.json构建异常求助

解决MAUI.NET 7 Android集成Firebase推送时的反序列化错误
  • 移除.csproj中导入的Xamarin.GooglePlayServices.Basement.targets语句,MAUI不需要依赖旧Xamarin的targets文件处理Google服务配置,这是导致文件匹配错误的核心原因。
  • 确保google-services.json的Build Action设置为GoogleServicesJson,可直接在.csproj中明确配置该文件属性,避免通配符误匹配:
    <ItemGroup>
      <GoogleServicesJson Include="google-services.json" />
    </ItemGroup>
    
  • 检查已安装的NuGet包,卸载不必要的Xamarin旧包(如Xamarin.Google.Dagger),改用适配MAUI的Firebase相关包(如Xamarin.Firebase.Messaging,需选择兼容.NET 7的版本),避免包冲突引发配置异常。
  • 清理项目的bin和obj文件夹,重启Visual Studio后重新生成项目,清除旧配置缓存。

内容的提问来源于stack exchange,提问作者ErikTheHack

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 17:27:06