MAUI 和 Firebase 在 Android 上构建错误,但调试有效

问题描述 投票:0回答:1

过去几天我将 Firebase 推送通知添加到我的 MAUI (net8.0) 项目中。该项目仅支持iOS和Android。在物理设备(iOS 和 Android)上进行调试时,一切都按预期运行。现在我不想为封闭的测试轨道构建发行版本。在 iOS 上,我生成 ipa 文件没有任何问题。但是当我尝试构建 Android 捆绑包时,我收到 220 文件复制错误。奇怪的是,所有这些错误都与 nuget 包“xamarin.firebase.ios.cloudfirestore”有关。我认为在构建 Android 时根本不应该复制哪个?

下面我添加了 2 个错误作为示例:

1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\arm64\Microsoft.Common.CurrentVersion.targets(4911,5): error MSB3030: Could not copy the file "C:\Users\mwa\.nuget\packages\xamarin.firebase.ios.cloudfirestore\8.10.0.3\lib\net6.0-ios15.4\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64\grpc.framework\PrivateHeaders\src\core\tsi\alts\zero_copy_frame_protector\alts_grpc_record_protocol_common.h" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\arm64\Microsoft.Common.CurrentVersion.targets(4911,5): error MSB3030: Could not copy the file "C:\Users\mwa\.nuget\packages\xamarin.firebase.ios.cloudfirestore\8.10.0.3\lib\net6.0-ios15.4\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64_x86_64-simulator\grpc.framework\PrivateHeaders\src\core\ext\filters\client_channel\client_channel_channelz.h" because it was not found.

有谁知道这是怎么回事以及如何解决这个问题?

我已经浏览了 .csproj 文件,清理了项目,删除了 bin 和 obj 文件夹。似乎找不到解决方案。

firebase build maui
1个回答
0
投票

错误信息表明临时路径太长。您可以转到

Environment Variables
并将临时文件夹更改为 c: empc: 。之后重新启动计算机。原始文件夹位于
C:\Users<username>\AppData\Local\Temp\Xamarin

更改后,在 Visual Studio 中,转到包管理器控制台来构建您的项目。您无法使用 GUI 进行构建。您可以在控制台中手动构建它。

dotnet构建--framework net8.0-android

dotnet构建--framework net8.0-ios

从控制台构建后,您可以单击“调试”。它将跳过构建。

欲了解更多详情,您可以参考以下链接:

https://github.com/dotnet/maui/issues/17828 https://github.com/xamarin/GoogleApisForiOSComponents/issues/555

© www.soinside.com 2019 - 2024. All rights reserved.