TobiasBuchholz / Plugin.Firebase

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

MAUI program cannot build #311

Closed ckrutsinger closed 4 months ago

ckrutsinger commented 5 months ago

Build never completes after adding Plugin.Firebase 3.0 to dependencies.

Visual Studio Community 2022 v17.10.2 Plugin.Firebase 3.0

Sample project to reproduce: https://github.com/ckrutsinger/FirebasePluginBuild.git

This is a new MAUI project after only adding Plugin.Firebase 3.0 dependency using NuGet.

The following packages were added via Developer Powershell:

dotnet add package AdamE.Firebase.iOS.Analytics -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.Auth -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.CloudFirestore -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.CloudFunctions -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.CloudMessaging -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.Core -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.Crashlytics -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.DynamicLinks -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.RemoteConfig -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.Storage -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.ABTesting -s https://api.nuget.org/v3/index.json 
dotnet add package AdamE.Firebase.iOS.Installations -s https://api.nuget.org/v3/index.json

When building with VS2022, build will hang. Contents of output window:

Build started at 5:59 PM...
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
Running restore with 16 concurrent jobs.
Reading project file C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\FirebasePluginBuild.csproj.
The restore inputs for 'FirebasePluginBuild' have changed. Continuing restore.
Restoring packages for C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\FirebasePluginBuild.csproj...
Restoring packages for .NETCoreApp,Version=v8.0...
Restoring packages for .NETCoreApp,Version=v8.0...
Restoring packages for .NETCoreApp,Version=v8.0...
Restoring packages for .NETCoreApp,Version=v8.0...
Resolving conflicts for net8.0-ios17.2...
Resolving conflicts for net8.0-windows10.0.19041...
Resolving conflicts for net8.0-maccatalyst17.2...
Resolving conflicts for net8.0-android34.0...
Scanning packages for runtime.json files...
Restoring packages for net8.0-android34.0/android-arm...
Resolving conflicts for net8.0-android34.0/android-arm...
Restoring packages for net8.0-android34.0/android-arm64...
Resolving conflicts for net8.0-android34.0/android-arm64...
Restoring packages for net8.0-android34.0/android-x64...
Resolving conflicts for net8.0-android34.0/android-x64...
Restoring packages for net8.0-android34.0/android-x86...
Resolving conflicts for net8.0-android34.0/android-x86...
Restoring packages for net8.0-android34.0/iossimulator-x64...
Resolving conflicts for net8.0-android34.0/iossimulator-x64...
Restoring packages for net8.0-android34.0/maccatalyst-x64...
Resolving conflicts for net8.0-android34.0/maccatalyst-x64...
Restoring packages for net8.0-android34.0/win10-x64...
Resolving conflicts for net8.0-android34.0/win10-x64...
Scanning packages for runtime.json files...
Restoring packages for net8.0-ios17.2/android-arm...
Resolving conflicts for net8.0-ios17.2/android-arm...
Restoring packages for net8.0-ios17.2/android-arm64...
Resolving conflicts for net8.0-ios17.2/android-arm64...
Restoring packages for net8.0-ios17.2/android-x64...
Resolving conflicts for net8.0-ios17.2/android-x64...
Restoring packages for net8.0-ios17.2/android-x86...
Resolving conflicts for net8.0-ios17.2/android-x86...
Restoring packages for net8.0-ios17.2/iossimulator-x64...
Resolving conflicts for net8.0-ios17.2/iossimulator-x64...
Restoring packages for net8.0-ios17.2/maccatalyst-x64...
Resolving conflicts for net8.0-ios17.2/maccatalyst-x64...
Restoring packages for net8.0-ios17.2/win10-x64...
Resolving conflicts for net8.0-ios17.2/win10-x64...
Scanning packages for runtime.json files...
Restoring packages for net8.0-maccatalyst17.2/android-arm...
Resolving conflicts for net8.0-maccatalyst17.2/android-arm...
Restoring packages for net8.0-maccatalyst17.2/android-arm64...
Resolving conflicts for net8.0-maccatalyst17.2/android-arm64...
Restoring packages for net8.0-maccatalyst17.2/android-x64...
Resolving conflicts for net8.0-maccatalyst17.2/android-x64...
Restoring packages for net8.0-maccatalyst17.2/android-x86...
Resolving conflicts for net8.0-maccatalyst17.2/android-x86...
Restoring packages for net8.0-maccatalyst17.2/iossimulator-x64...
Resolving conflicts for net8.0-maccatalyst17.2/iossimulator-x64...
Restoring packages for net8.0-maccatalyst17.2/maccatalyst-x64...
Resolving conflicts for net8.0-maccatalyst17.2/maccatalyst-x64...
Restoring packages for net8.0-maccatalyst17.2/win10-x64...
Resolving conflicts for net8.0-maccatalyst17.2/win10-x64...
Scanning packages for runtime.json files...
Restoring packages for net8.0-windows10.0.19041/android-arm...
Resolving conflicts for net8.0-windows10.0.19041/android-arm...
Restoring packages for net8.0-windows10.0.19041/android-arm64...
Resolving conflicts for net8.0-windows10.0.19041/android-arm64...
Restoring packages for net8.0-windows10.0.19041/android-x64...
Resolving conflicts for net8.0-windows10.0.19041/android-x64...
Restoring packages for net8.0-windows10.0.19041/android-x86...
Resolving conflicts for net8.0-windows10.0.19041/android-x86...
Restoring packages for net8.0-windows10.0.19041/iossimulator-x64...
Resolving conflicts for net8.0-windows10.0.19041/iossimulator-x64...
Restoring packages for net8.0-windows10.0.19041/maccatalyst-x64...
Resolving conflicts for net8.0-windows10.0.19041/maccatalyst-x64...
Restoring packages for net8.0-windows10.0.19041/win10-x64...
Resolving conflicts for net8.0-windows10.0.19041/win10-x64...
  CACHE https://api.nuget.org/v3/vulnerabilities/index.json
  CACHE https://api.nuget.org/v3-vulnerabilities/2024.06.14.23.24.38/vulnerability.base.json
  CACHE https://api.nuget.org/v3-vulnerabilities/2024.06.14.23.24.38/2024.06.19.11.24.49/vulnerability.update.json
All packages and projects are compatible with net8.0-android34.0.
All packages and projects are compatible with net8.0-ios17.2.
All packages and projects are compatible with net8.0-maccatalyst17.2.
All packages and projects are compatible with net8.0-windows10.0.19041.
All packages and projects are compatible with net8.0-android34.0 (android-arm).
All packages and projects are compatible with net8.0-android34.0 (android-arm64).
All packages and projects are compatible with net8.0-android34.0 (android-x64).
All packages and projects are compatible with net8.0-android34.0 (android-x86).
All packages and projects are compatible with net8.0-android34.0 (iossimulator-x64).
All packages and projects are compatible with net8.0-android34.0 (maccatalyst-x64).
All packages and projects are compatible with net8.0-android34.0 (win10-x64).
All packages and projects are compatible with net8.0-ios17.2 (android-arm).
All packages and projects are compatible with net8.0-ios17.2 (android-arm64).
All packages and projects are compatible with net8.0-ios17.2 (android-x64).
All packages and projects are compatible with net8.0-ios17.2 (android-x86).
All packages and projects are compatible with net8.0-ios17.2 (iossimulator-x64).
All packages and projects are compatible with net8.0-ios17.2 (maccatalyst-x64).
All packages and projects are compatible with net8.0-ios17.2 (win10-x64).
All packages and projects are compatible with net8.0-maccatalyst17.2 (android-arm).
All packages and projects are compatible with net8.0-maccatalyst17.2 (android-arm64).
All packages and projects are compatible with net8.0-maccatalyst17.2 (android-x64).
All packages and projects are compatible with net8.0-maccatalyst17.2 (android-x86).
All packages and projects are compatible with net8.0-maccatalyst17.2 (iossimulator-x64).
All packages and projects are compatible with net8.0-maccatalyst17.2 (maccatalyst-x64).
All packages and projects are compatible with net8.0-maccatalyst17.2 (win10-x64).
All packages and projects are compatible with net8.0-windows10.0.19041 (android-arm).
All packages and projects are compatible with net8.0-windows10.0.19041 (android-arm64).
All packages and projects are compatible with net8.0-windows10.0.19041 (android-x64).
All packages and projects are compatible with net8.0-windows10.0.19041 (android-x86).
All packages and projects are compatible with net8.0-windows10.0.19041 (iossimulator-x64).
All packages and projects are compatible with net8.0-windows10.0.19041 (maccatalyst-x64).
All packages and projects are compatible with net8.0-windows10.0.19041 (win10-x64).
Committing restore...
Generating MSBuild file C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\obj\FirebasePluginBuild.csproj.nuget.g.props.
Generating MSBuild file C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\obj\FirebasePluginBuild.csproj.nuget.g.targets.
Writing assets file to disk. Path: C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\obj\project.assets.json
Writing cache file to disk. Path: C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\obj\project.nuget.cache
Persisting dg to C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\obj\FirebasePluginBuild.csproj.nuget.dgspec.json
Restored C:\Users\chuck\source\repos\FirebasePluginBuild\FirebasePluginBuild\FirebasePluginBuild.csproj (in 863 ms).
NuGet package restore finished.

Build never continues.

This is happening to our production app and causing major disruptions to our development activities. Hope someone can help.

ckrutsinger commented 5 months ago

More info:

Sometimes I try to clean I get:

Clean started at 4:21 PM...
1>Error: Cancelled
========== Clean: 0 succeeded, 1 failed, 0 skipped ==========
========== Clean completed at 4:21 PM and took 00.178 seconds ==========
Verification of Android environment is running. Please try again in a moment.
The build was cancelled

I then wait a bit and try clean again and clean will succeed.

Then I get this message when I attempt to run on local android device:

Build started at 4:15 PM...
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
Error occurred while restoring NuGet packages: The operation failed as details for project ... could not be loaded.

If I then cancel build and use Task Manager to kill 7-zip, run button begins to work.

Seems like C:\Users\chuck\AppData\Local\XamarinBuildDownloadCache\GAppM-10.24.0.tgz is getting unpacked by 7-zip and gets stuck.

AdamEssenmacher commented 5 months ago

The repro project seems to be missing.

Visual Studio has all sorts of problems building, deploying, and debugging iOS.NET apps with complex XCFramework dependencies due to limited support for long file paths.

You may be running into some of that. In addition, XamarinBuildDownload is a somewhat tenuous part of the build chain that's also more likely to break when VS / Windows is paired to a mac.

Try clearing your local .nuget cache(s), your local XamarinBuildDownload cache, enable long file path support if you haven't already, reboot your system, and then finally try to build your project from the CLI (leave VS closed!).

One other thing, it looks like you have Windows set as a build target. This plugin doesn't support that at all.

ckrutsinger commented 4 months ago

@AdamEssenmacher Thanks for getting back to me.

More data points:

This is really affecting us, so any other help you can offer would be awesome.

AdamEssenmacher commented 4 months ago

GAppM is an iOS dependency. Your build is getting stuck downloading an iOS dependency while you're not pairing to mac? Maybe try pairing to mac?

ckrutsinger commented 4 months ago

@AdamEssenmacher I can only think that GAppM is downloading because of dotnet restore activity.

AdamEssenmacher commented 4 months ago

Not exactly. It downloads during the build, not restore.

But... connecting to mac is required to build for iOS, right? And you're not connected?

ckrutsinger commented 4 months ago

@AdamEssenmacher I am not building for mac on the windows machine. I hit the run button to run on locally attached android device and 7-zip gets hung up.

AdamEssenmacher commented 4 months ago

MAUI is going to build everything regardless of your run target.

Try removing your mac/iOS target frameworks if you only want to build for Android.

ckrutsinger commented 4 months ago

@AdamEssenmacher It won't be practical for us to add/remove targets while developing. That will end up getting something checked into repo that won't build for other platform. This is a corporate project for both platforms and with many developers. All of us are struggling to get build to run. I need a way to have the project buildable/debuggable for all.

ckrutsinger commented 4 months ago

@AdamEssenmacher We have downgraded to 2.x versions of the plugin since we cannot deal with these build issues. Thank you for looking at it.

AdamEssenmacher commented 4 months ago

I'll continue this at: https://github.com/AdamEssenmacher/GoogleApisForiOSComponents/issues/4

douglasc211 commented 4 days ago

VS 17.11.5 still broken when I add the AdamE IOS projects as well. I can get an azure pipeline to build for me, but forget about a build for debugging. Same exact spot the build stops Extracting GAppM-10.28.0.tgz