簡體   English   中英

沒有 static 方法 delimiterOffset 在 class Lokhttp3/internal/Util

[英]No static method delimiterOffset in class Lokhttp3/internal/Util

我正在使用 jitsi 庫進行視頻連接。 第一次安裝時它工作正常,但如果用戶已經擁有應用程序並從 Play 商店更新它,它會崩潰。 崩潰日志說:

沒有 static 方法 delimiterOffset(Ljava/lang/String;IILjava/lang/String;)I 在 class Lokhttp3/internal/Util; 或其超類('okhttp3.internal.Util' 的聲明出現在 base.apk.classes3.dex 中)

有 2 個自動生成的文件:1) okhttp3.JavaNetCookieJar 2) okhttp3.internal.Util。

從 class JavaNetCookieJar ,此delimiterOffset(header, pos, limit, ";,")方法在Util class 中調用。

Util的 delimiterOffset() 方法與調用的方法不兼容:

delimiterOffset(delimiters: String, startIndex: Int = 0, endIndex: Int = length)

delimiterOffset(delimiter: Char, startIndex: Int = 0, endIndex: Int = length)

上述方法在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 . 我在用

implementation 'com.squareup.okhttp3:logging-interceptor:4.8.0'

有趣的事實是,即使我在 gradle 中刪除 okhttp3 實現,這兩個文件也不受影響。

您必須使用所有 OkHttp 依賴項的完全相同版本。 您可以手動配置或使用 BOM 自動配置。

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!
}

檢查您的 gradle 是否有此行:

configurations {
    all*.exclude group: 'com.squareup.okio'
    all*.exclude group: 'com.squareup.okhttp3'
}

如果是這樣,只需刪除它或評論它

configurations {
    //all*.exclude group: 'com.squareup.okio'
    //all*.exclude group: 'com.squareup.okhttp3'
}

現在清理並重建項目。

除了這樣的例外:錯誤堆棧跟蹤

我能夠通過注釋掉/android/app/build.gradle中的行來解決它:

    public void apply(OkHttpClient.Builder builder) {
      // builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM