Default Firebase App Not Initialized, but not clear how to add package explicitly [Android]
See original GitHub issueIf you receive an error that states the default Firebase App is not initialized, adding one package explicitly seems to resolve this issue (it doesn’t seem to matter which package gets added).
I am getting this error but am not to sure what it means to “add the package explicitly”.
I have the Plugin.Firebase package installed via nuget, and everything works great in iOS. In Firebase Console I can see the analytics register for IOS when I open the app. But android is giving this error at runtime, and no Firebase Analytics seem to register at all.
here are some possibly related lines a few lines beforehand.
I tried adding Xamarin.Firebase.Analytics package 120.1.2 via Nuget. Didn’t seem to do anything. Here is relevant entry in CSPROJ
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-android'">
<GoogleServicesJson Include="google-services.json" />
<PackageReference Include="Xamarin.Firebase.Analytics" Version="120.1.2" />
</ItemGroup>
Any help explaining what “adding the package explicitly” means would be helpful!
Details: .Net Maui, running in android emulator on Mac
On iOS, I get the following message, no errors : 8.10.0 - [Firebase/Analytics][I-ACS023007] Analytics v.8.10.0 started
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I Finally figured it out. Exasperated, I created a fresh app, and tried to find the source of the issue. The issue was that the package name (i.e. com.me.myapp) was different in the CSPROJ file compared to the google services json’s package’s. I guess Visual Studio puts in some filler there, rather than the correct package name.
In .csproj:
I was able to view debug events from analytics and everything now. Thanks so much for the awesome package. Looking forward to playing around with Firestore now.
Sorry for the noob mistake. If I get some time, I will do a PR to add that info in the setup readme to help future MAUI noobs like me.
This is gold, please add to the official docs @TobiasBuchholz