Closed RR99Link closed 10 months ago
As you can see in the error message the issue occurs related to Xamarin.Firebase.iOS.Installations, which is an implicit depency of Xamarin.Firebase.iOS.CloudMessaging, the native library Plugin.Firebase
is using to support push notifications. So I think this issue is not related to Plugin.Firebase
, but to Xamarin.Firebase.iOS.Installations
, so please open an issue here.
In my humble opinion: Your export path
bin\Debug\net8.0-ios\iossimulator-x64\Firebase.Installations.resources\FirebaseInstallations.xcframework\ios-arm64_x86_64-simulator\FirebaseInstallations.framework\Headers\FIRInstallationsErrors.h
is exceeding the Windows file length of 260 letters. Somewhere there is a component which still has problems with this.
Can you please count your absolute ouput path letters?
In this situation the path length is 261 and if I change the bin and obj path to D:\b and D:\o it builds correctly, but I think there is some problem, because even if I set the nuget packages path as D:\p, I can't install the nuget package Plugin.Firebase, but I can install Plugin.Firebase.Core and Plugin.Firebase.CloudMessaging. It would be nice to be able to install the Plugin.Firebase package directly
Do you install Plugin.Firebase using the CLI? I would suggest to do so - it only works like this on my computer (also because of path length).
In Visual Studio add Developer Power Shell
, cd to your project folder and install using the cli dotnet add package Plugin.Firebase
.
But if you add the plugin with the command because of the path length, how do you build without problems after that?
I guess it depends what kind of component has a problem with the path length.
Have you tried to remove the packages from your project, remove it manually from your nuget folder (just to be safe) and then add it "to your project" using the cli?
I think the path length problem is with the Plugin.Firebase.Auth component of the Plugin.Firebase. I resolved It by installing directly Plugin.Firebase.Core and Plugin.Firebase.CloudMessaging, but the problem still remains for Plugin.Firebase
Hi, I could manage the problem and now I can compile the iOS .Net 8 Maui App with Pulgin.Firtebase. I used "dotnet restore" to get the nuget package. But now I'd like to publish the app and I can't create an archive with the Archive Manager from Visual Studio 2022, because the path is too long! The zip file can be craeted, but the Unzip task crashes. The path, where the zip file is created is: C:\Users\Marian.GRZESIK\AppData\Local\Xamarin\iOS\Archives\2024-01-05 When I try to unzip the file in c:\tmp, than it works. Is it possible to shorten the paths? It worked well in Xamarin.Forms, but in .Net Maui it doesn't.
Here's more information on the issue.
https://github.com/dotnet/maui/issues/17828
Here is a workaround for those that need to publish for app stores. I just used an Azure DevOps Pipeline and the macos-13 image to build an iOS 17.0 Asp.Net 8 version of my app with Plugin.Firebase. Here's how I did it.
I did a Build in Visual Studio without Plugin.Firebase installed and the Firebase code was commented out. I then added Plugin.Firebase using View - Terminal - dotnet add package Plugin.Firebase. This added the package without errors. I then uncommented my Firebase code and did a commit without Building / Rebuilding the Solution in Visual Studio. This committed my code to Azure DevOps and started the Pipeline. The dotnet restore Task worked in the Pipeline as did the Publish Task to build the ipa file.
Seeing as Firebase doesn't take up too much code for me, this a workaround I can live with for now. I just have to comment out some code and remove Plugin.Firebase whenever I need to do any work on the app. ;)
I assume this will work for Android as well, but I have not tested it.
Hope this helps!
UPDATE -> I had to make the following code change in csproj.
<!--Added for Plugin.Firebase-->
<!--<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-ios17.0'">
<BundleResource Include="GoogleService-Info.plist" />
</ItemGroup>-->
<ItemGroup Condition="$(TargetFramework.Contains('-ios'))">
<MauiAsset Include="GoogleService-Info.plist" LogicalName="GoogleService-Info.plist" />
</ItemGroup>
I'm now able to send push notifications. Before this change, I was getting this error in Sentry.
Objective-C exception thrown. Name: com.firebase.core Reason:
FirebaseApp.configure()could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.
After struggling with this myself for multiple days and slogging through misleading errors, fiddly/brittle config and red herring warnings, I thought it best to give back a working solution to the community.
This repo contains a fairly minimal working .NET 8 project targeting iOS and Android with Firebase Cloud Messaging, Analytics and the relevant build pipelines to get them built and pushed into App Center.
https://github.com/coop-tim/maui-sample
Hoping this helps whilst the root issues are worked on.
@TobiasBuchholz we should start consolidating these long path problems into one issue and close the rest as duplicates.
The answer is the same for all of them:
@coop-tim thanks a lot for your sample project and it's extensive description! I've referenced it in the sample section of the plugin's readme 👍
@AdamEssenmacher I've added a troubleshooting section to the plugin's readme and copied some text from @coop-tim's project description that explains how to resolve the long path issue as well as your bullet points as additional hints.
I am trying to implement and compile with Visual Studio 2022 in Windows 11 with push notifications in my MAUI application for both Android and iOS. I receive the following error when building: "Unable to copy file "D:\p\xamarin.firebase.ios.installations\8.10.0.3\lib\net6.0-ios15.4\Firebase.Installations.resources\FirebaseInstallations.xcframework\ios-arm64_x86_64-simulator\FirebaseInstallations.framework\Headers\FIRInstallationsErrors.h" to "bin\Debug\net8.0-ios\iossimulator-x64\Firebase.Installations.resources\FirebaseInstallations.xcframework\ios-arm64_x86_64-simulator\FirebaseInstallations.framework\Headers\FIRInstallationsErrors.h". Could not find a part of the path 'bin\Debug\net8.0-ios\iossimulator-x64\Firebase.Installations.resources\FirebaseInstallations.xcframework\ios-arm64_x86_64-simulator\FirebaseInstallations.framework\Headers\FIRInstallationsErrors.h'"
I have already a custom Nuget configuration with a minimal path (D:\p), enabled long paths in the registry and in the 'Local Group Policy Editor'.
Tried to implement Plugin.Firebase --> path too long Tried to implement Plugin.Firebase.CloudMessaging and Plugin.Firebase.Core --> can't build without errors because the path is too long