Flagsmith / Flagsmith/flagsmith-kotlin-android-client

Add Proguard consumer rules for Retrofit

Open
#62 3 comments 0 reactions 1 assignee Claimed by @gazreese View on GitHub
Dominant language
Kotlin
Stars
8
Forks
18
PR merge metrics
No merged PRs in 30d

Description

When using Proguard/R8, our app crashes with Flagsmith with the following exception:

```
FATAL EXCEPTION: main
Process: redacted, PID: 22008
java.lang.IllegalArgumentException: Unable to create call adapter for interface N7.c
for method c.a
at N7.X.j(Unknown Source:39)
at N7.o.a(Unknown Source:2792)
at N7.Q.invoke(Unknown Source:102)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy1.a(Unknown Source)
at redacted.RemoteConfig$Companion.init$redacted(Unknown Source:120)
at redacted.doSetup(Unknown Source:85)
at redacted.MyApplication$onCreate$1.invokeSuspend(Unknown Source:47)
at o6.a.resumeWith(Unknown Source:8)
at kotlinx.coroutines.DispatchedTask.run(Unknown Source:108)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@a0ae3d4, Dispatchers.Main]
Caused by: java.lang.IllegalArgumentException: Call return type must be parameterized as Call or Call
at N7.n.a(Unknown Source:44)
at C.h.l(Unknown Source:34)
at N7.o.a(Unknown Source:2627)
... 15 more
```

It works however after adding the following rules (we don't use Retrofit otherwise, that's why we have to add them specifically for Flagsmith):

```
-if interface * { @retrofit2.http.* ; }
-keep,allowobfuscation interface <1>
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.