0

我正在使用 okhttp3 版本4.9.3、okhttp3 日志拦截器4.9.3和 okio 版本3.0.0。我的代码类似于下面的代码片段(我使用的是 Android)。但我总是得到这个错误:java.lang.NoClassDefFoundError: Failed resolution of: Lokio/Buffer.

public void OkHttpTest(String token){
    OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
    Request request = new Request.Builder()
            .url("https://cloud.seatable.io/api/v2.1/dtable/app-access-token/")
            .method("GET", null)
            .addHeader("Accept", "application/json; charset=utf-8; indent=4")
            .addHeader("Authorization", "Token d4c25e8b1af1893fd35d41a3404f6353497fh36r")
            .build();
    client.newCall(request).enqueue(new okhttp3.Callback() {
      @Override
      public void onFailure(@NotNull Call call, @NotNull IOException e) {
        OnError(e.toString(), "Test");
      }

      @Override
      public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
        GotResponse(Objects.requireNonNull(response.body()).toString());
      }
    });
  }
4

0 回答 0