I have a Xamarin Forms Solution in Visual Studio 2019. I am working with just the Android version for now. The full error is:
Java.Lang.IllegalStateException Message=Default FirebaseApp is not initialized in this process appcardview.sample.android. Make sure to call FirebaseApp.initializeApp(Context) first.
In my Android project, I am trying to connect to Firebase Authentication. I have added my google-services.json. I have seen online that it should be added as:
<ItemGroup>
<GoogleServicesJson Include="google-services.json" />
</ItemGroup>
But that gives me an error telling me that GoogleServicesJson is unrecognized, so I added it in my .csproj file as
<ItemGroup>
<None Include="google-services.json" />
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
1-I have also added the following line in the beginning fo the onCreate method in my MainActivity class in the android project; I have added it to the beginning of my onCreate, maybe I need to place it somewhere else?:
FirebaseApp.InitializeApp(Application.Context);
2-Can the problem be the way I added it in my .csproj file?
3-Someone also mentioned the following and I am not sure what it means or what I should change, maybe this is the problem?
Make sure that your package name is identical to the package name inside “google-services.json”