TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
220 stars 49 forks source link

Problem building MAUI NET7 App using Plugin.Firebase #167

Closed fgiacomelli closed 1 year ago

fgiacomelli commented 1 year ago

Hello, I am working to a MAUI App based on .NET7. Push notification works greatly on Android, but on iOS I'm receiving a lot of errors that avoid to complete the build if the plugin is installed.

I am working at this project with other developers, that have the same problems. I tried to solve it using 3 differents versions of Visual Studio (17.5.5, 17.6 and 17.7 preview) but the error persist.

I have 29 errors, all related to "xamarin.firebase.ios.XXX", except one that is related to "xamarin.google.ios.signin". Here a couple of them:

Errore  MT7091  Il file 'C:/Users/Fabio/.nuget/packages/xamarin.google.ios.signin/5.0.2.4/lib/net6.0-ios15.4/Google.SignIn.resources/GTMAppAuth.xcframework/ios-arm64_x86_64-simulator/GTMAppAuth.framework/GTMAppAuth' non è un framework valido: Unable to read beyond the end of the stream. APP_ENERCOM_3   C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\targets\Xamarin.Shared.Sdk.targets    672 
Errore  MT7091  Il file 'C:/Users/Fabio/.nuget/packages/xamarin.firebase.ios.storage/8.10.0.3/lib/net6.0-ios15.4/Firebase.Storage.resources/FirebaseStorage.xcframework/ios-arm64_x86_64-simulator/FirebaseStorage.framework/FirebaseStorage' non è un framework valido: Unable to read beyond the end of the stream.   APP_ENERCOM_3   C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\targets\Xamarin.Shared.Sdk.targets    672 

I think it could be related to the version of packages used from the plugin itself, that requires different versions of some dependecies of my project. I noticed that effectively the plugin.firebase targets .NET6.0 and not .NET7. I tried to download the source and upgrade the plugins used internally, like Xamarin.firebase.messaging or Xamarin.GooglePlayServices.Auth, but I can't complete it because the newest versions are incompatible with the project:

(NU1202 Package Xamarin.Firebase.Analytics 121.2.2 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Xamarin.Firebase.Analytics 121.2.2 supports:
  - monoandroid12.0 (MonoAndroid,Version=v12.0)
  - net6.0-android31.0 (.NETCoreApp,Version=v6.0)

I attach here below a screnshot of the errors.

How can we solve the problem? At this time seems to be impossible to use the plugin in a MAUI app based on NET7 that targets iOS

error_updating_plugin

vhugogarcia commented 1 year ago

Uninstall all the packages dependencies and just leave Plugin.Firebase itself.

If you are going to use only some specific features of the Plugin, then just install the needed libraries, don't install all of them.

For example: I installed Firebase.Auth, Firebase.CloudMessaging because I need those only on my project.

Then delete the /bin /obj folders from your project, close Visual Studio and open it again and re-build 👍🏻

fgiacomelli commented 1 year ago

Thank you for your reply @vhugogarcia , I'm not sure to have understood your suggestion, what do you propose to do? If I install only the firebase plugin, it doesn't work and I have the errors specified here below.

Should have I to:

image

Mouso00 commented 1 year ago

I have the similar issue , i uninstall the plugin.firebase and i install the previous 2.0.2 version seems like there is progress you can try this! G.L

MiSteiner commented 1 year ago

We have the same issues for all our iOS specific libraries, not just Plugin.Firebase, after updating VS to 17.6 A rollback to version 17.5.4, clearing the nuget folder, as well as the obj & bin folders in the project seems to have fixed the issue for us.

However, on another device we were not able to fix it so far.

scriptBoris commented 1 year ago

In general, does microsoft know about this problem? Maybe we should tell them?

This is some kind of madness, this critical problem will soon be a month old and there is still no unambiguous solution. Everyone has project deadlines burning!!

vhugogarcia commented 1 year ago

Thank you for your reply @vhugogarcia , I'm not sure to have understood your suggestion, what do you propose to do? If I install only the firebase plugin, it doesn't work and I have the errors specified here below.

Should have I to:

  • install Plugin.Firebase
  • manually uninstall what? all the dependencies required from plugin.firebase except the one I'm using, from this list?

image

I am sorry for the late answer, somehow I missed the notification. What I meant to say is that do not install Plugin.Firebase but instead install only Plugin.Firebase.xxxxx (features you need in your project).

Then delete the /bin /obj folders from your project, close Visual Studio and open it again and re-build 👍🏻

JamesSonic commented 1 year ago

Hello,

Has there been any news?

sfysi commented 1 year ago

Installing just Plugin.Firebase.CloudMessaging didn't solve the problem for me, either. Its dependency on Xamarin.Firebase.iOS.CloudMessaging seems to be the issue; even just installing that package gives me the same error: Could not copy the file "C:\Users\Me.nuget\packages\xamarin.firebase.ios.installations\8.10.0.3\lib...\something.h" because it was not found.

The files it claims are missing are different every time I try rebuilding and changing the packages installed, but every time I check in the directory and confirm that those files do in fact exist. Deleting bin and obj, clearing out the .nuget/packages folder entirely, cleaning the project, restarting and updating Visual Studio... none of that helped. The package works fine in .NET 6, but as soon as the project switches to .NET 7, it all breaks down. Since the dependency is specifically on the Xamarin.Firebase.iOS side of things, I'm not even sure if there's a way to work around this.

goatrodeosoftware commented 1 year ago

Replacing Plugin.Firebase with just the CloudMessaging package got it fixed for me- thanks.

MichaelDenwood commented 1 year ago

Installing just Plugin.Firebase.CloudMessaging didn't solve the problem for me, either. Its dependency on Xamarin.Firebase.iOS.CloudMessaging seems to be the issue; even just installing that package gives me the same error: Could not copy the file "C:\Users\Me.nuget\packages\xamarin.firebase.ios.installations\8.10.0.3\lib...\something.h" because it was not found.

The files it claims are missing are different every time I try rebuilding and changing the packages installed, but every time I check in the directory and confirm that those files do in fact exist. Deleting bin and obj, clearing out the .nuget/packages folder entirely, cleaning the project, restarting and updating Visual Studio... none of that helped. The package works fine in .NET 6, but as soon as the project switches to .NET 7, it all breaks down. Since the dependency is specifically on the Xamarin.Firebase.iOS side of things, I'm not even sure if there's a way to work around this.

I have tried all suggestions here and still getting the error quoted above. Any other suggestions?

RESOLVED:
We added this package to our project : Xamarin.Firebase.iOS.CloudMessaging

And it magically started working.

In addition, we only had this issue when building iOS from windows machines.

sfysi commented 1 year ago

I have tried all suggestions here and still getting the error quoted above. Any other suggestions?

Unfortunately, the solution in my case was to stop using this plugin and use Xamarin.Firebase.Messaging on its own.

goatrodeosoftware commented 1 year ago

It's replacing Plugin.Firebase with .CloudMessaging- having both doesn't fix the symptoms.

MichaelDenwood commented 1 year ago

It's replacing Plugin.Firebase with .CloudMessaging- having both doesn't fix the symptoms.

We have to have both of them in order to get around the issue. I don't know why.

TobiasBuchholz commented 1 year ago

Since I haven't heard from you in more than 30 days, I hope this issue is no longer affecting you. If it is, please reopen this issue and provide the more information so that I can look into it further. Thank you!

goatrodeosoftware commented 1 year ago

Hi Tobias- thanks for your response. I don't think we need to provide more information, unless you have something to ask? The comments affirm that only replacing the plugin with something else did it, so it's still affecting us until there's a new release to fix it.