From 66392fee455a79363049e4ac0eba68a04d9666b3 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Mon, 6 Jul 2026 16:26:13 +0200 Subject: [PATCH] fix(samples): Add Retrofit R8 full-mode keep rules to Android sample The Android sample's release build uses R8 full mode, which strips generic signatures from classes that aren't kept. This broke Retrofit call-adapter creation for GithubAPI, crashing SecondActivity in onResume with 'Unable to create call adapter for interface retrofit2.Call'. Add the standard Retrofit R8 keep rules (Signature attributes, retrofit2.Call/Response, service interfaces) and keep the Repo response model for Gson. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../sentry-samples-android/proguard-rules.pro | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sentry-samples/sentry-samples-android/proguard-rules.pro b/sentry-samples/sentry-samples-android/proguard-rules.pro index 1165340c893..5f4016f8f72 100644 --- a/sentry-samples/sentry-samples-android/proguard-rules.pro +++ b/sentry-samples/sentry-samples-android/proguard-rules.pro @@ -32,3 +32,15 @@ -dontwarn org.openjsse.javax.net.ssl.SSLParameters -dontwarn org.openjsse.javax.net.ssl.SSLSocket -dontwarn org.openjsse.net.ssl.OpenJSSE + +# Retrofit relies on generic signatures for its service methods. Under R8 full mode these are +# stripped for classes that aren't kept, which breaks call-adapter creation (SecondActivity's +# GithubAPI request). Keep the signature attributes and Retrofit's generic types. +-keepattributes Signature, InnerClasses, EnclosingMethod +-keep,allowobfuscation,allowshrinking interface retrofit2.Call +-keep,allowobfuscation,allowshrinking class retrofit2.Response +-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface <1> +# Keep the response model so Gson can deserialize it. +-keep class io.sentry.samples.android.Repo { *; }