xamarin / GoogleApisForiOSComponents

MIT License
225 stars 161 forks source link

Crashlytics GoogleService-Info.plist file when each config has a different name #492

Open cjsharp01 opened 3 years ago

cjsharp01 commented 3 years ago

Hi, I have crashlytics in the App. I use a file named "GoogleServices-Info.plist" but my environment has two differently named files depending on the selected configuration:

   <BundleResource Include="GoogleService-InfoCitizen.plist" Condition="'$(Configuration)' == 'Release'">
      <LogicalName>GoogleService-Info.plist</LogicalName>
      <SubType>Designer</SubType>
    </BundleResource>
    <BundleResource Include="GoogleService-InfoStaff.plist" Condition="'$(Configuration)' == 'Staff Release'">
      <LogicalName>GoogleService-Info.plist</LogicalName>
      <SubType>Designer</SubType>
    </BundleResource>

However, when I try to build it the crashlytics upload-symbol command fails because it cannot find the "GoogleServices-info.plist" file as the file is actually named "GoogleService-InfoCitizen.plist". Is there anywhere in the settings that I can configure GoogleService-Info.plist to point to GoogleService-InfoCitizen.plist? Or at the very least is there a way to replace the GoogleService-Info.plist file with the Citizen/Staff one in the pre-build events?

Thanks in advance

GalaxiaGuy commented 3 years ago

The way I did this was to create a new property that could differ based on configuration:

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
   ...
  <ConfigurationPath>Debug</ConfigurationPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
   ...
  <ConfigurationPath>Release</ConfigurationPath>
</PropertyGroup>

And then use the following:

<BundleResource Include="..\Configurations\$(ConfigurationPath)\GoogleService-Info.plist" Link="GoogleService-Info.plist" />

I put the files in different folders based on configuration, but it could just as well be as part of the file name.