Where can i add google-services.json in xamarin app

江枫思渺然 提交于 2019-12-22 03:42:42

问题


Hi we are developing Xamarin application where we want monitor how many peoples install application from our referral id.

Im find this document https://developers.google.com/analytics/devguides/collection/android/v4/ where it says "Copy the google-services.json file you just downloaded into the app/ or mobile/ directory of your Android Studio project.".

I have visual studio (2013) project where these folders are missing of course. Question is, where i add the google-services.json file in visual studio project ?

Thanks in advance


回答1:


I don't believe that file is necessary for Xamarin projects.




回答2:


I don't know when it became necessary, but as I'm posting this (in May 2017), it is necessary. I placed mine in the same directory that my Android .csproj file was located. I then added it to the project and made sure that Xamarin.GooglePlayServices.Base.targets was in my .csproj. I read that rebuilding would be sufficient for making the proper build action to appear, but building and restarting XS is what did it for me. The final result in my .csproj was this:

<ItemGroup>
    <GoogleServicesJson Include="google-services.json" />
</ItemGroup>



回答3:


  1. Copy the google-services.json to your solution Droid folder
  2. Go to vs solution explorer and right click on Droid project -> Add -> Existing Item (it will added to the solution)
  3. Right click on google-services.json and go to properties
  4. In the Properties pane, set the Build Action to GoogleServicesJson



回答4:


In order to have the option of set Build Action to GoogleServicesJson you should install Xamarin.GooglePlayServices.Base via Nuget first. then close VS and reopen.



来源:https://stackoverflow.com/questions/33435552/where-can-i-add-google-services-json-in-xamarin-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!