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

天大地大妈咪最大 提交于 2019-11-27 22:53:11
shahzain ali

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'
}
Jolson Da Costa

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

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

android {
       compileSdkVersion 23
       ....
       defaultConfig {
       ..
       ..
       }
 useLibrary 'org.apache.http.legacy'
}
Atul O Holic

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!