Skip to content

Sentry.Maui (6.2) is incompatible with Firebase dependencies #5043

@diegoful

Description

@diegoful

Package

Sentry.Maui

.NET Flavor

.NET

.NET Version

10.0.201

OS

Android

OS Version

29+

Development Environment

Visual Studio v18.x

Other Error Monitoring Solution

No

Other Error Monitoring Solution Name

No response

SDK Version

6.2.0

Self-Hosted Sentry Version

No response

Workload Versions

Workload version: 10.0.201

Installed Workload Id      Manifest Version         Installation Source
-----------------------------------------------------------------------------------
android                    36.1.43/10.0.100         SDK 10.0.200, VS 18.4.11605.240
ios                        26.2.10217/10.0.100      SDK 10.0.200, VS 18.4.11605.240
maccatalyst                26.2.10217/10.0.100      SDK 10.0.200, VS 18.4.11605.240
maui-android               10.0.20/10.0.100         SDK 10.0.200
maui-windows               10.0.20/10.0.100         SDK 10.0.200, VS 18.4.11605.240

UseSentry or SentrySdk.Init call

This is compilation issue. No need to initialize Sentry to repro.

Steps to Reproduce

  1. Create a new MAUI App from Visual Studio "create new project" wizard.
  2. Edit the project file (e.g. MauiApp1.csproj) and set the SupportedOSPlatformVersion for android to 29, then add a reference to the main Firebase package (<PackageReference Include="Plugin.Firebase" Version="4.2.1" />). Alternatively, copy paste the full contents into the project file:
<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFrameworks>net10.0-android</TargetFrameworks>
		<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
		<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>

		<!-- Note for MacCatalyst:
		The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
		When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
		The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
		either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
		<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

		<OutputType>Exe</OutputType>
		<RootNamespace>MauiAppSentry2</RootNamespace>
		<UseMaui>true</UseMaui>
		<SingleProject>true</SingleProject>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>enable</Nullable>

		<!-- Enable XAML source generation for faster build times and improved performance.
		     This generates C# code from XAML at compile time instead of runtime inflation.
		     To disable, remove this line.
		     For individual files, you can override by setting Inflator metadata:
		       <MauiXaml Update="MyPage.xaml" Inflator="Default" /> (reverts to defaults: Runtime for Debug, XamlC for Release)
		       <MauiXaml Update="MyPage.xaml" Inflator="Runtime" /> (force runtime inflation) -->
		<MauiXamlInflator>SourceGen</MauiXamlInflator>

		<!-- Display name -->
		<ApplicationTitle>MauiAppSentry2</ApplicationTitle>

		<!-- App Identifier -->
		<ApplicationId>com.companyname.mauiappsentry2</ApplicationId>

		<!-- Versions -->
		<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
		<ApplicationVersion>1</ApplicationVersion>

		<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
		<WindowsPackageType>None</WindowsPackageType>

		<AndroidManifestMerger>legacy</AndroidManifestMerger>

		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">29.0</SupportedOSPlatformVersion>
		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
		<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>


		<BuildInParallel>false</BuildInParallel>
	</PropertyGroup>

	<ItemGroup>
		<!-- App Icon -->
		<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

		<!-- Splash Screen -->
		<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

		<!-- Images -->
		<MauiImage Include="Resources\Images\*" />
		<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
		
		<!-- Custom Fonts -->
		<MauiFont Include="Resources\Fonts\*" />

		<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
		<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
	</ItemGroup>
	

	<ItemGroup>
		<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
		<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
		<PackageReference Include="Plugin.Firebase" Version="4.2.1" />
	</ItemGroup>
</Project>
  1. Try to deploy app to local Android emulator. App should run without issues.
  2. Add a package referece to Sentry.Maui (<PackageReference Include="Sentry.Maui" Version="6.2.0" />).
  3. Try to deploy app to local Android emulator. Building fails (see logs below).

Expected Result

Build succeeds.

Actual Result

Build fails with the following error(s):

1>  MauiAppSentry2 -> C:\Users\diego\source\repos\MauiAppSentry2\MauiAppSentry2\bin\Debug\net10.0-android\MauiAppSentry2.dll
1>MSBUILD : java.exe error JAVA0000: Error in obj\Debug\net10.0-android\lp\302\jl\libs\826722D732ACA824.jar:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class:
1>MSBUILD : java.exe error JAVA0000: Type com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream is defined multiple times: obj\Debug\net10.0-android\lp\302\jl\libs\826722D732ACA824.jar:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class, obj\Debug\net10.0-android\lp\394\jl\libs\8E428AF64A795598.jar:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class
1>MSBUILD : java.exe error JAVA0000: Compilation failed
1>MSBUILD : java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net10.0-android\lp\302\jl\libs\826722D732ACA824.jar
1>MSBUILD : java.exe error JAVA0000: com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.xv.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:131)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.main(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:5)
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net10.0-android\lp\302\jl\libs\826722D732ACA824.jar:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class
1>MSBUILD : java.exe error JAVA0000: 	at Version.fakeStackEntry(Version_8.11.18.java:0)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.P.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:1)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.xv.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:82)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.xv.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:32)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.xv.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:31)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.xv.b(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:2)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:30)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.b(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:23)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:28)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.xv.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:118)
1>MSBUILD : java.exe error JAVA0000: 	... 1 more
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.internal.g: Type com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream is defined multiple times: obj\Debug\net10.0-android\lp\302\jl\libs\826722D732ACA824.jar:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class, obj\Debug\net10.0-android\lp\394\jl\libs\8E428AF64A795598.jar:com/google/protobuf/AbstractMessageLite$Builder$LimitedInputStream.class
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.yg0.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:21)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.O80.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:54)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.O80.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:10)
1>MSBUILD : java.exe error JAVA0000: 	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.O80.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:6)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.graph.z4$a.c(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:6)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:56)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.dex.c.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:12)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:33)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.d(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:20)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.D8.c(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:8)
1>MSBUILD : java.exe error JAVA0000: 	at com.android.tools.r8.internal.xv.a(R8_8.11.18_94248c9a6fd57686ded562f231d18f14e8923ad1fe977e99b974a9bf901c8a48:28)
1>MSBUILD : java.exe error JAVA0000: 	... 6 more
1>MSBUILD : java.exe error JAVA0000: Directory 'obj\Debug\net10.0-android\lp\302' is from 'Sentry.Bindings.Android.aar'.
1>MSBUILD : java.exe error JAVA0000: Directory 'obj\Debug\net10.0-android\lp\394' is from 'Xamarin.Protobuf.JavaLite.aar'.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeBugSomething isn't working
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions