Issue
I am using jitsi library for video connection. It works fine when installed for the first time but it crashes if a user already has application and updates it from play store. Logs from crash says:
No static method delimiterOffset(Ljava/lang/String;IILjava/lang/String;)I in class Lokhttp3/internal/Util; or its super classes (declaration of 'okhttp3.internal.Util' appears in base.apk!classes3.dex)
There are 2 auto generated files: 1) okhttp3.JavaNetCookieJar 2) okhttp3.internal.Util.
From class JavaNetCookieJar
, this delimiterOffset(header, pos, limit, ";,")
method is called in Util
class.
Util
class has delimiterOffset() method not compatible with the one which is called:
delimiterOffset(delimiters: String, startIndex: Int = 0, endIndex: Int = length)
delimiterOffset(delimiter: Char, startIndex: Int = 0, endIndex: Int = length)
Above methods are called there in Util
class.
When I hover over JavaNetCookieJar
class, it says that it comes from okhttp3-urlconnection-3.12.1
package and when I hover over Util
package it says that it's from okhttp-4.8.0
. I am using
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.0'
Fun fact is even when I am deleting okhttp3 implementation in gradle, these 2 files are unaffected.
Solution
You must use the exact same version of all OkHttp dependencies. You can configure this manually or use the BOM to do it automatically.
dependencies {
api(platform("com.squareup.okhttp3:okhttp-bom:4.8.0"))
api("com.squareup.okhttp3:okhttp") // No version!
api("com.squareup.okhttp3:logging-interceptor") // No version!
}
Answered By - Jesse Wilson
Answer Checked By - David Marino (JavaFixing Volunteer)