java.lang.NoSuchMethodError: No static method parseString
MostafaAmerAts opened this issue · 1 comments
MostafaAmerAts commented
I have the following gradle file for Java application
`
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 33
defaultConfig {
applicationId "appID"
minSdkVersion 26
targetSdkVersion 33
multiDexEnabled = true
versionCode 63
versionName "2.0.1"
}
applicationVariants.all { variant ->
variant.getRuntimeConfiguration().exclude group: 'com.google.code.findbugs', module: 'jsr305'
variant.getRuntimeConfiguration().exclude group: 'org.webrtc.AndroidVideoDecoder', module: 'jetified-opentok-android-sdk-v3-3.1.6-runtime.jar'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "default"
productFlavors {
production {
// flavor data
}
staging {
flavorDimensions "default"
applicationIdSuffix ".staging"
versionNameSuffix "-staging"
// flavor data
}
dev {
flavorDimensions "default"
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
// flavor data
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def project = "AppName"
def separator = "_"
def buildType = variant.buildType.name
def versionName = variant.versionName
def versionCode = variant.versionCode
def date = new Date()
def formattedDate = date.format('yyyy_MM_dd')
def flavor = variant.baseName;
def newApkName = project + separator + "v" +
versionName + separator + versionCode + separator +
flavor + separator + formattedDate + ".apk"
output.outputFileName = newApkName
}
}
bundle {
language {
enableSplit = false
}
}
namespace 'appId'
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.multidex:multidex:2.0.1'
implementation project(path: ':indoor_navigation_sdk')
implementation project(path: ':oppwa.mobile')
implementation('org.jitsi.react:jitsi-meet-sdk:2.9.3') { transitive = true }
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.aakira:expandable-layout:1.6.0@aar'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.mikhaellopez:circularimageview:4.1.1'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
implementation 'org.sufficientlysecure:html-textview:3.6'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:17.1.0'
implementation 'com.google.gms:google-services:4.3.15'
implementation 'com.github.msarhan:ummalqura-calendar:1.1.9'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
annotationProcessor 'android.arch.lifecycle:common-java8:1.1.1'
implementation 'com.kontaktio:sdk:4.0.3'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.1.2'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
implementation 'com.google.openlocationcode:openlocationcode:1.0.4'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.10"
implementation 'com.google.code.gson:gson:2.10.1'
// Add the Firebase Crashlytics SDK.
implementation platform('com.google.firebase:firebase-bom:30.3.2')
implementation('com.google.firebase:firebase-core') {
exclude module: "play-services-ads-identifier"
exclude module: "play-services-measurement"
exclude module: "play-services-measurement-sdk"
}
implementation('com.google.firebase:firebase-messaging') {
exclude module: "play-services-ads-identifier"
exclude module: "play-services-measurement"
exclude module: "play-services-measurement-sdk"
}
implementation('com.google.firebase:firebase-crashlytics') {
exclude module: "play-services-ads-identifier"
exclude module: "play-services-measurement"
exclude module: "play-services-measurement-sdk"
}
implementation('com.google.firebase:firebase-analytics') {
exclude module: "play-services-ads-identifier"
exclude module: "play-services-measurement"
exclude module: "play-services-measurement-sdk"
}
implementation 'com.github.jkwiecien:EasyImage:3.2.0'
implementation 'org.greenrobot:eventbus:3.2.0'
debugImplementation "com.github.chuckerteam.chucker:library:4.0.0"
releaseImplementation "com.github.chuckerteam.chucker:library-no-op:4.0.0"
implementation 'com.karumi:dexter:6.2.2'
implementation 'com.otaliastudios:zoomlayout:1.8.0'
implementation 'com.xlw.zoom:zoomlayout:1.0.0'
implementation 'com.localebro:okhttpprofiler:1.0.8'
implementation 'com.facebook.fresco:fresco:2.4.0'
implementation 'com.facebook.fresco:animated-gif:2.4.0'
implementation 'com.pnikosis:materialish-progress:1.0'
}
apply plugin: 'com.google.gms.google-services'`
I'm using Chucker version 4.0.0 but when I hit an API and open the Chucker app to see the log and open API details it crashes with the following record:
FATAL EXCEPTION: main
Process: ats.ksa.kfsh.patient, PID: 15324
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/~~ta4fm5TV3qpbkJoXnBbtIA==/ats.ksa.kfsh.patient-4Y8ztGKmPj16gBB0wcxC8Q==/base.apk!classes2.dex)
at com.chuckerteam.chucker.internal.support.FormatUtils.formatJson(FormatUtils.kt:57)
at com.chuckerteam.chucker.internal.support.SpanTextUtil.spanJson(SpanTextUtil.kt:83)
at com.chuckerteam.chucker.internal.data.entity.HttpTransaction.spanBody(HttpTransaction.kt:236)
at com.chuckerteam.chucker.internal.data.entity.HttpTransaction.getSpannedRequestBody(HttpTransaction.kt:251)
at com.chuckerteam.chucker.internal.ui.transaction.TransactionPayloadFragment$processPayload$2.invokeSuspend(TransactionPayloadFragment.kt:340)
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:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@f639a0a, Dispatchers.Main.immediate]
cortinico commented
I believe your problem is caused by a wrong version of GSON which you end up using (different than 2.10.1
). This can be caused by a number of factors, like a resolution strategy set somewhere else in your build logic.
Without a reproducer, it's impossible to say what's going on.