ChuckerTeam/chucker

java.lang.NoSuchMethodError: No static method parseString

maheritdev opened this issue · 6 comments

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]

Which version of OkHTTP are you using?
It seems like this is related to square/retrofit#3058

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

Which version of OkHTTP are you using?

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.

any new, i faced i same issues