{"id":171,"date":"2018-07-17T12:32:16","date_gmt":"2018-07-17T11:32:16","guid":{"rendered":"http:\/\/android.wp.w3.pt\/?p=171"},"modified":"2018-07-17T12:42:42","modified_gmt":"2018-07-17T11:42:42","slug":"org-apache-http-no-androidstudio","status":"publish","type":"post","link":"http:\/\/android.w3.pt\/?p=171","title":{"rendered":"&#8220;org.apache.http&#8221; no AndroidStudio"},"content":{"rendered":"<p>A partir da vers\u00e3o 23 da API (Android S.O. 6), o &#8220;org.apache.http&#8221; ficou obsoleto.<br \/>\nAconselham a usar a classe URLConnection.<\/p>\n<p>Mas ainda \u00e9 poss\u00edvel usar o &#8220;org.apache.http&#8221;, desde que se use, no gradle [\u00e9 mesma solu\u00e7\u00e3o que a indicada abaixo]:<\/p>\n<p>android {<br \/>\n    useLibrary &#8216;org.apache.http.legacy&#8217;<br \/>\n}<\/p>\n<p>(ver: <a href=\"https:\/\/stackoverflow.com\/questions\/32153318\/httpclient-wont-import-in-android-studio\">https:\/\/stackoverflow.com\/questions\/32153318\/httpclient-wont-import-in-android-studio<\/a>)<\/p>\n<hr>\n<p>[outro texto a dizer o mesmo]<br \/>\nPara adicionar a biblioteca &#8220;org.apache.http&#8221; a um projeto no AndroidStudio<\/p>\n<p>1. Criar um novo projeto, ou abrir um onde queira adicionar a biblioteca..<br \/>\n2. Clicar no seguinte ficheiro do projeto, nos Gradle Scripts: build.gradle(Module : app) .<br \/>\n3. Adicionar a linha seguinte dentro de android { defaultConfig { &#8230; } }<\/p>\n<p><code>useLibrary 'org.apache.http.legacy'<\/code><\/p>\n<p><a href=\"http:\/\/android.w3.pt\/?attachment_id=172\" rel=\"attachment wp-att-172\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/android.w3.pt\/wp-content\/uploads\/sites\/7\/2018\/07\/build_gradle_module_app-300x249.png\" alt=\"\" width=\"300\" height=\"249\" class=\"alignnone size-medium wp-image-172\" srcset=\"http:\/\/android.wp.w3.pt\/wp-content\/uploads\/sites\/7\/2018\/07\/build_gradle_module_app-300x249.png 300w, http:\/\/android.wp.w3.pt\/wp-content\/uploads\/sites\/7\/2018\/07\/build_gradle_module_app-100x83.png 100w, http:\/\/android.wp.w3.pt\/wp-content\/uploads\/sites\/7\/2018\/07\/build_gradle_module_app.png 351w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>J\u00e1 est\u00e1!<\/p>\n<p>(ver: <a href=\"https:\/\/androidjson.com\/resolve-symbol-import-http-client-library\/\">https:\/\/androidjson.com\/resolve-symbol-import-http-client-library\/<\/a>)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A partir da vers\u00e3o 23 da API (Android S.O. 6), o &#8220;org.apache.http&#8221; ficou obsoleto. Aconselham a usar a classe URLConnection. Mas ainda \u00e9 poss\u00edvel usar o &#8220;org.apache.http&#8221;, desde que se use, no gradle [\u00e9 mesma solu\u00e7\u00e3o que a indicada abaixo]: android { useLibrary &#8216;org.apache.http.legacy&#8217; } (ver: https:\/\/stackoverflow.com\/questions\/32153318\/httpclient-wont-import-in-android-studio) [outro texto a dizer o mesmo] Para adicionar [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/android.w3.pt\/index.php?rest_route=\/wp\/v2\/posts\/171"}],"collection":[{"href":"http:\/\/android.w3.pt\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/android.w3.pt\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/android.w3.pt\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/android.w3.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=171"}],"version-history":[{"count":8,"href":"http:\/\/android.w3.pt\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":180,"href":"http:\/\/android.w3.pt\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions\/180"}],"wp:attachment":[{"href":"http:\/\/android.w3.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/android.w3.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/android.w3.pt\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}