not able to import com.squareup.okhttp.OkHttpClient;

前端 未结 5 2081
既然无缘
既然无缘 2020-12-10 13:46

I am working on android studio and fetching some data from the web. I tried using OkHttpClient and also added jars to my project folder but still i am unable t

5条回答
  •  旧巷少年郎
    2020-12-10 14:19

    Gradle should have a line like this

    implementation 'com.squareup.okhttp3:okhttp:3.0.1' 
    

    and this is how you import it

    import okhttp3.OkHttpClient;
    

    Because OkHttpClient has been moved from package com.squareup.okhttp to okhttp3 in the last version.

    More details are here and here

提交回复
热议问题