ChuckerTeam / chucker

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

java.lang.NoSuchMethodError: No static method parseString #902

Open maheritdev opened 1 year ago

maheritdev commented 1 year ago

when I use the library with java code to handle the bug of Android 12 and above I got this error when I open chucker to see the Api data

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: ats.jo.royal.patient.dev, PID: 24675
    java.lang.NoSuchMethodError: No static method parseString(Ljava/lang/String;)Lcom/google/gson/JsonElement; in class Lcom/google/gson/JsonParser;` or its super classes (declaration of 'com.google.gson.JsonParser' appears in /data/app/~~baRMxdN_LkhPazLLWRcmsQ==/ats.jo.royal.patient.dev-gxKSg1_qoEJETFmYV5aKCA==/base.apk!classes2.dex)
        at com.chuckerteam.chucker.internal.support.FormatUtils.formatJson(FormatUtils.kt:57)
        at com.chuckerteam.chucker.internal.data.entity.HttpTransaction.formatBody(HttpTransaction.kt:210)
        at com.chuckerteam.chucker.internal.data.entity.HttpTransaction.getFormattedRequestBody(HttpTransaction.kt:223)
        at com.chuckerteam.chucker.internal.ui.transaction.TransactionPayloadFragment$processPayload$2.invokeSuspend(TransactionPayloadFragment.kt:226)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
        Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@b00062b, Dispatchers.Main.immediate]
cortinico commented 1 year ago

Which version of OkHTTP are you using? It seems like this is related to https://github.com/square/retrofit/issues/3058

maheritdev commented 1 year ago

I tried all of these solutions but with no benefits unfortunately. android version 12 and above

cortinico commented 1 year ago

Which version of OkHTTP are you using?

rayworks commented 1 year ago

Hi @maheritdev I've met the same issue before, pls make sure you're using the correct gson version (>= 2.8.7) after integrating Chucker library. In my case, I have 2 different gson versions which caused the trouble.

hoangchungk53qx1 commented 9 months ago

any new, i faced i same issues