ChuckerTeam / chucker

🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Apache License 2.0
3.86k stars 337 forks source link

IllegalStateException when open single API request information on release build. #1183

Closed volic closed 5 months ago

volic commented 6 months ago

:writing_hand: Describe the bug

I cannot export or see the API call information. The chucker is crashing with the release build with R8.

java.lang.IllegalStateException: TypeToken must be created with a type argument: new TypeToken<...>() {}; When using code shrinkers (ProGuard, R8, ...) make sure that generic signatures are preserved.
at se.a.e(SourceFile:41)
at se.a.<init>(SourceFile:2)
at com.chuckerteam.chucker.internal.data.entity.HttpTransaction$b.<init>(SourceFile:1)
at com.chuckerteam.chucker.internal.data.entity.HttpTransaction.getParsedRequestHeaders(SourceFile:11)
at com.chuckerteam.chucker.internal.data.entity.HttpTransaction.getRequestHeadersString(SourceFile:3)
at com.chuckerteam.chucker.internal.ui.transaction.TransactionPayloadFragment$processPayload$2.invokeSuspend(SourceFile:49)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:12)
at kotlinx.coroutines.s0.run(SourceFile:129)
at kotlinx.coroutines.scheduling.CoroutineScheduler.q(SourceFile:1)
at kotlinx.coroutines.scheduling.CoroutineScheduler$c.d(SourceFile:15)
at kotlinx.coroutines.scheduling.CoroutineScheduler$c.p(SourceFile:29)
at kotlinx.coroutines.scheduling.CoroutineScheduler$c.run(SourceFile:1)

:bomb: Steps to reproduce

  1. Go to Chucker from the notification panel
  2. Click on any specific API call or try to export all requests

:wrench: Expected behavior

The information about API calls is accessible and not crashing.

:camera: Screenshots

:android: Tech info

:page_facing_up: Additional context

cortinico commented 6 months ago

This feels like a misconfiguration of yours with Proguard. You should not use Proguard on debug builds (where Chucker is included)

volic commented 6 months ago

Thank you for your quick response. We use the Chucker in release (named qa builds) builds. We use them for QA purposes where our testers can observe and extract the API data for bug tickets. Is there no way to use the Chucker in release builds?

cortinico commented 6 months ago

We use the Chucker in release (named qa builds) builds. We use them for QA purposes where our testers can observe and extract the API data for bug tickets. Is there no way to use the Chucker in release builds

Well you can but then you'll have to configure proguard so that it doens't strip or obfuscate the classes you see in the stacktrace

WildOrangutan commented 6 months ago

@cortinico would you mind adding consumer rules for proguard?

We have the same use case as volic, where we have a separate flavor for QA.

cortinico commented 6 months ago

@cortinico would you mind adding consumer rules for proguard?

Happy to receive a PR that adds them 👍

volic commented 5 months ago

Thank you