Skip to content

Commit 7db3f1b

Browse files
authored
fix: Adding proguard rules to Sentry.Bindings.Android (getsentry#2450)
1 parent 5401fed commit 7db3f1b

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Fixes
1111

12+
- Builds targeting Android with `r8` enabled no longer crash during SDK init. The package now contains the required proguard rules ([#2450]https://github.com/getsentry/sentry-dotnet/pull/2450)
1213
- Fix Sentry logger options for MAUI and Azure Functions ([#2423](https://github.com/getsentry/sentry-dotnet/pull/2423))
1314

1415
### Dependencies

samples/Sentry.Samples.Android/Sentry.Samples.Android.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
<ItemGroup>
1313
<ProjectReference Include="..\..\src\Sentry\Sentry.csproj" />
1414
<Using Include="Android.App.Activity" Alias="Activity" />
15+
16+
<!--
17+
The NuGet package the containing the binding comes with a .targets that sets the ProguardConfiguration
18+
Since we're referencing the project itself we're grabbing the ProguardConfiguration from project directly.
19+
-->
20+
<ProguardConfiguration Include="..\..\src\Sentry.Bindings.Android\sentry-proguard.cfg" />
1521
</ItemGroup>
1622

1723
<!--

src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<ItemGroup>
1313
<None Remove="$(MSBuildThisFileDirectory)..\..\README.md" />
1414
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="" />
15+
<None Include="$(MSBuildThisFileDirectory)build/Sentry.Bindings.Android.targets" Pack="true" PackagePath="build/$(TargetFramework)$(TargetPlatformVersion)/Sentry.Bindings.Android.targets" />
16+
<None Include="$(MSBuildThisFileDirectory)sentry-proguard.cfg" Pack="true" PackagePath="" />
1517
<PackageReference Remove="SIL.ReleaseTasks" />
1618
</ItemGroup>
1719

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<ItemGroup>
3+
<ProguardConfiguration Include="$(MSBuildThisFileDirectory)..\..\proguard.cfg" />
4+
</ItemGroup>
5+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Because we use string-based lookups we need to keep names on selected sentry-java classes
2+
-keep class io.sentry.Sentry { *; }
3+
-keep class io.sentry.android.core.SentryAndroid { *; }
4+
-keep class io.sentry.android.core.SentryAndroidOptions { *; }
5+
-keep class io.sentry.android.core.SentryInitProvider { *; }
6+
-keep class io.sentry.android.core.SentryPerformanceProvider { *; }
7+
-keep class io.sentry.android.supplemental.* { *; }
8+
-keep class io.sentry.protocol.** { *; }

0 commit comments

Comments
 (0)