Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't set Build Action to GoogleServiceJson

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

like image 500
oceankit Avatar asked Mar 08 '17 17:03

oceankit


4 Answers

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')" />
like image 112
SushiHangover Avatar answered Nov 20 '22 05:11

SushiHangover


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.

like image 33
Venu Gopal Tewari Avatar answered Nov 20 '22 04:11

Venu Gopal Tewari


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

like image 7
Suliman Farzat Avatar answered Nov 20 '22 05:11

Suliman Farzat


In Visual Studio close the Project and reopen it. That worked for me:)

like image 3
KPS250 Avatar answered Nov 20 '22 03:11

KPS250