I'm working with Xamarin-Android to make an application, so I need to set Build Action to my google-services.json file but there is no such Property as GoogleServicesJson, and when I try just to write it, it shows me an exception:
Exception of type 'System.Runtime.InteropServices.ExternalException' was thrown.
I tried to save and then restart Visual Studio, but it didn't solve the problem.
If you know how to solve this problem, please help me! :)
That's the file I'm clicking on
The GoogleServicesJson
build type comes from the Xamarin.GooglePlayServices.Basement.targets
.
If your project does not have Xamarin.GooglePlayServices.Basement
installed via one of its dependents, usually Xamarin.GooglePlayServices.Gcm
or Xamarin.Firebase.Messaging
if we are talking about messaging, then you will not have that build action available.
After adding a package that installs Basement, or manually adding it yourself, your .csproj
will contain an import for Xamarin.GooglePlayServices.Basement.targets
and GoogleServicesJson
will be available as a build type:
.csproj
import example:
<Import Project="..\packages\Xamarin.GooglePlayServices.Basement.42.1001.0\build\MonoAndroid70\Xamarin.GooglePlayServices.Basement.targets" Condition="Exists('..\packages\Xamarin.GooglePlayServices.Basement.42.1001.0\build\MonoAndroid70\Xamarin.GooglePlayServices.Basement.targets')" />
Even after installing "Xamarin.GooglePlayServices.Basement" GoogleServiceJson option was not showing. Surprisingly but when i quit Xamarin studio and opened it again it starts displaying.
1-Download first these Packages:
Xamarin.Firebase.Common
Xamarin.Firebase.Config
Xamarin.Firebase.Iid
Xamarin.GooglePlayServices.Base
Xamarin.GooglePlayServices.Basement
Xamarin.GooglePlayServices.Tasks
2-then restart and rebuild
3-from google-services.json --> Properties --> build Action: GoogleServicesJson
In Visual Studio close the Project and reopen it. That worked for me:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With