Skip to content

Commit 61ba1d5

Browse files
runningcodeclaude
andauthored
fix(samples): Add Retrofit R8 full-mode keep rules to Android sample (#5727)
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) <noreply@anthropic.com>
1 parent 803fad4 commit 61ba1d5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

sentry-samples/sentry-samples-android/proguard-rules.pro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,15 @@
3232
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
3333
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
3434
-dontwarn org.openjsse.net.ssl.OpenJSSE
35+
36+
# Retrofit relies on generic signatures for its service methods. Under R8 full mode these are
37+
# stripped for classes that aren't kept, which breaks call-adapter creation (SecondActivity's
38+
# GithubAPI request). Keep the signature attributes and Retrofit's generic types.
39+
-keepattributes Signature, InnerClasses, EnclosingMethod
40+
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
41+
-keep,allowobfuscation,allowshrinking class retrofit2.Response
42+
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
43+
-if interface * { @retrofit2.http.* <methods>; }
44+
-keep,allowobfuscation interface <1>
45+
# Keep the response model so Gson can deserialize it.
46+
-keep class io.sentry.samples.android.Repo { *; }

0 commit comments

Comments
 (0)