The import org.apache.http.client cannot be resolved error when I update sdk to M

后端 未结 4 1132
说谎
说谎 2020-12-06 04:48

I am getting following errors when I import project into eclipse. I have updated my sdk to M.

import org.apache.http.HttpEntity;
import org.apache.http.HttpR         


        
相关标签:
4条回答
  • 2020-12-06 05:33

    apache http and NameValuePair has been deprecated in api 23. youl have to manualy add apache library check this .

    or may be you should start using from now HttpURLConnection . check this answer for same

    0 讨论(0)
  • 2020-12-06 05:35

    Another way to achieve the same is,

    Find org.apache.http.legacy.jar which is in Android/Sdk/platforms/android-23/optional, add it to your dependency.

    Source

    0 讨论(0)
  • 2020-12-06 05:39

    For eclipse -- Find library in your sdk and add it manually platforms/android-23/optional/org.apache.http.legacy.jar

    For android studio add this line in build.gradle

    android {
        useLibrary 'org.apache.http.legacy'
    }
    
    0 讨论(0)
  • 2020-12-06 05:43

    for android studio add one line in build.gradle file of app like:

    android {
           compileSdkVersion 23
           ....
           defaultConfig {
           ..
           ..
           }
     useLibrary 'org.apache.http.legacy'
    }
    
    0 讨论(0)
提交回复
热议问题