0
這裏是我的依賴,NoClassDefFoundError的:失敗分辨率:Lokhttp3 /日誌/ HttpLoggingInterceptor
//retrofit and gson dependencies
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
和代碼,使用HttpLoggingInterceptor是這樣的,
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
retrofit = new Retrofit.Builder()
.baseUrl(URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create())
.build();
我已經refered到this question和錯誤我得到,他們說更新依賴版本。我已經嘗試所有版本的okHttp.logging攔截器,但仍然無法工作。任何人都可以知道我要去哪裏錯了。
我不明白是什麼原因背後的代碼不起作用的第一個地方。它浪費了我的2小時只是顯示此異常。清潔項目做了工作。謝謝 – shalini