小编NEX*_*EXT的帖子

java.lang.NoClassDefFoundError:无法解决以下问题:Lokio / Buffer;

当我使用Retrofit时,出现异常java.lang.NoClassDefFoundError:失败的解析度:Lokio / Buffer;我使用okhttpclient来设置Retrofit的标头。get userList是一个post方法,我需要在请求中发送主体。

private void getUserList(int startIndex){
    final JSONObject audienceObj = ProtocolHelper.getProtocolUtils(mContext).getUserlistJsonObj(mRoomData.mUid, mRoomData.mRoomId, startIndex);
    OkHttpClient okClient = new OkHttpClient.Builder()
    .addInterceptor(
        new Interceptor() {
          @Override
          public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException {
                Request original = chain.request();

                // Request customization: add request headers
                Request.Builder requestBuilder = original.newBuilder()
                        .header("sessionId", CommonData.getUserInfo(mContext).sessionId);
                Request request = requestBuilder.build();
                return chain.proceed(request);
            }
        })
    .build();


    String baseUrl = ProtocolUtils.BASE_URL+"/";
    Retrofit retrofit = new Retrofit.Builder()
    .baseUrl(baseUrl)
    .addConverterFactory(GsonConverterFactory.create())
    .client(okClient)
    .build();

    String audienceUrl = ProtocolHelper.getProtocolUtils(mContext).getProtocolUrl(ProtocolUtils.PROTOCOL_MSG_ID_MEMBER_LIST);
    AudienceInterface audienceInterface = retrofit.create(AudienceInterface.class);
    Call<String> call …
Run Code Online (Sandbox Code Playgroud)

retrofit

2
推荐指数
2
解决办法
4595
查看次数

标签 统计

retrofit ×1