Cody
Cody

Reputation: 319

.NET MAUI apps connected to different Firebase projects are instead logging to one project

I have a .NET 8 MAUI project with different build configurations for brands that use my app. Each configuration has an Android Manifest, google-services.json, etc. so they build under different app IDs and should connect to the different firebase projects. I have not tested on iOS yet, but it currently isn't working as expected on Android.

In my csproj, I have properties set like so:

<!-- I have one for release as well -->
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='[Brand]Debug|net8.0-android|AnyCPU'">
    <AndroidSigningKeyStore>Platforms\Android\Keystores\[brand].keystore</AndroidSigningKeyStore>
    <AndroidManifest>Platforms\Android\[Brand]\AndroidManifest.xml</AndroidManifest>
    ...
</PropertyGroup>

...

<ItemGroup Condition="(('$(Configuration)' == '[Brand]Debug' Or '$(Configuration)' == '[Brand]Release') And '$(TargetFramework)' == 'net8.0-android')">
    <None Remove="Platforms\Android\[MainBrand]\google-services.json" />
    <GoogleServicesJson Include="Platforms\Android\[Brand]\google-services.json" />
</ItemGroup>

The build-specific manifest, keystore, images, etc. are fine, but in the itemgroup, it doesn't seem to pick up the different google-services.json, so all logs (analytics and crashlytics) from all build configurations are showing up in my main brand's firebase logs. There is no mention of the google-services anywhere else in my csproj, each json was downloaded directly from the corresponding firebase project, they do look correct, and are in the correct folders.

Any idea why this is happening?

Upvotes: 0

Views: 139

Answers (1)

Cody
Cody

Reputation: 319

I figured it out, I had the main app ID hardcoded in my strings.xml which I must've done while following a tutorial in my initial setup. I simply removed that so it gets it dynamically and now it seems to work. So it was my own fault and just affected Android, not iOS.

Upvotes: 0

Related Questions