{"action":"created","issue":{"url":"https://api.github.com/repos/Mashape/unirest-java/issues/53","labels_url":"https://api.github.com/repos/Mashape/unirest-java/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/Mashape/unirest-java/issues/53/comments","events_url":"https://api.github.com/repos/Mashape/unirest-java/issues/53/events","html_url":"https://github.com/Mashape/unirest-java/issues/53","id":49963540,"number":53,"title":"Unable to find CloseableHttpClient","user":{"login":"tortilaman","id":5018268,"avatar_url":"https://avatars.githubusercontent.com/u/5018268?v=3","gravatar_id":"","url":"https://api.github.com/users/tortilaman","html_url":"https://github.com/tortilaman","followers_url":"https://api.github.com/users/tortilaman/followers","following_url":"https://api.github.com/users/tortilaman/following{/other_user}","gists_url":"https://api.github.com/users/tortilaman/gists{/gist_id}","starred_url":"https://api.github.com/users/tortilaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tortilaman/subscriptions","organizations_url":"https://api.github.com/users/tortilaman/orgs","repos_url":"https://api.github.com/users/tortilaman/repos","events_url":"https://api.github.com/users/tortilaman/events{/privacy}","received_events_url":"https://api.github.com/users/tortilaman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-11-25T00:52:48Z","updated_at":"2015-12-25T20:25:37Z","closed_at":null,"body":"I've gone about this several different ways now, and I'm running into roadblocks at each point. Here's the code that calls unirest:\r\n\r\n    package com.akqa.glass.recipie;\r\n    \r\n    import android.util.Log;\r\n    \r\n    import com.mashape.unirest.http.HttpResponse;\r\n    import com.mashape.unirest.http.JsonNode;\r\n    import com.mashape.unirest.http.Unirest;\r\n    import com.mashape.unirest.http.exceptions.UnirestException;\r\n    \r\n    import org.json.JSONException;\r\n    import org.json.JSONObject;\r\n    \r\n    import java.io.BufferedReader;\r\n    import java.io.File;\r\n    import java.io.InputStream;\r\n    import java.io.InputStreamReader;\r\n    \r\n    //import org.apache.http.HttpResponse;\r\n    //import org.shaded.apache.http.HttpHeaders;\r\n    \r\n    public class JSONParser {\r\n        static InputStream is = null;\r\n        static JSONObject jObj = null;\r\n        static String json = \"\";\r\n        private static final String TAG = JSONParser.class.getSimpleName();\r\n        // constructor\r\n        public JSONParser() {\r\n        }\r\n        public JSONObject getCamFindJSON(String type, String input) {\r\n            Log.d(\"PARSER\", \"Inside Parser\");\r\n            /*\r\n             *  Request processing from API\r\n             */\r\n            if(type == \"request\"){\r\n                try {\r\n                    HttpResponse<JsonNode> response = Unirest.post(\"https://camfind.p.mashape.com/image_requests\")\r\n                    .header(\"X-Mashape-Key\", \"Fhn5jZi5ixmshwnJMy7CGyj5yDCnp15DTQZjsniuwpVHfYHvFJ\")\r\n                    .field(\"image_request[image]\", new File(input))\r\n                    .field(\"image_request[language]\", \"en\")\r\n                    .field(\"image_request[locale]\", \"en_US\")\r\n                    .asJson();\r\n                } catch (UnirestException e) {\r\n                    Log.d(TAG, \"Couldn't get request\");\r\n                    e.printStackTrace();\r\n                }\r\n            }\r\n            /*\r\n             *  Receive response from API\r\n             */\r\n            else if(type == \"response\"){\r\n                try {\r\n                    HttpResponse<JsonNode> response = Unirest.get(\"https://camfind.p.mashape.com/image_responses/\" + input)\r\n                    .header(\"X-Mashape-Key\", \"Fhn5jZi5ixmshwnJMy7CGyj5yDCnp15DTQZjsniuwpVHfYHvFJ\")\r\n                    .asJson();\r\n                } catch (UnirestException e) {\r\n                    Log.d(TAG, \"Couldn't get reponse\");\r\n                    e.printStackTrace();\r\n                }\r\n            }\r\n            /*\r\n             *  Parse Response into readable JSON\r\n             */\r\n            try {\r\n                BufferedReader reader = new BufferedReader(new InputStreamReader(\r\n                        is, \"iso-8859-1\"), 8);\r\n                StringBuilder sb = new StringBuilder();\r\n                String line = null;\r\n                while ((line = reader.readLine()) != null) {\r\n                    sb.append(line + \"n\");\r\n                    Log.d(\"Raw Data\", line);\r\n                }\r\n                is.close();\r\n                json = sb.toString();\r\n            } catch (Exception e) {\r\n                Log.e(\"Buffer Error\", \"Error converting result \" + e.toString());\r\n            }\r\n            // try parse the string to a JSON object\r\n            try {\r\n                jObj = new JSONObject(json);\r\n            } catch (JSONException e) {\r\n                Log.e(\"JSON Parser\", \"Error parsing data \" + e.toString());\r\n                e.printStackTrace();\r\n            } catch (Exception e) {\r\n                Log.e(\"JSON Parse\", \"Unknown Error\");\r\n                e.printStackTrace();\r\n            }\r\n            // return JSON String\r\n            return jObj;\r\n        }\r\n    }\r\n\r\nHere is the logcat output:\r\n\r\n    11-24 16:26:57.473  12605-12856/com.akqa.glass.recipie E/dalvikvm﹕ Could not find class 'org.apache.http.impl.client.CloseableHttpClient', referenced from method com.mashape.unirest.http.Unirest.shutdown\r\n    11-24 16:26:57.473  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve check-cast 453 (Lorg/apache/http/impl/client/CloseableHttpClient;) in Lcom/mashape/unirest/http/Unirest;\r\n    11-24 16:26:57.473  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x1f at 0x0006\r\n    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie I/dalvikvm﹕ Could not find method org.apache.http.client.methods.HttpRequestBase.releaseConnection, referenced from method com.mashape.unirest.http.HttpClientHelper.request\r\n    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve virtual method 1085: Lorg/apache/http/client/methods/HttpRequestBase;.releaseConnection ()V\r\n    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0012\r\n    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie I/dalvikvm﹕ Could not find method org.apache.http.client.methods.HttpRequestBase.releaseConnection, referenced from method com.mashape.unirest.http.HttpClientHelper.request\r\n    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve virtual method 1085: Lorg/apache/http/client/methods/HttpRequestBase;.releaseConnection ()V\r\n    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0021\r\n    11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie I/dalvikvm﹕ Could not find method org.apache.http.client.config.RequestConfig.custom, referenced from method com.mashape.unirest.http.options.Options.refresh\r\n    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ VFY: unable to resolve static method 1059: Lorg/apache/http/client/config/RequestConfig;.custom ()Lorg/apache/http/client/config/RequestConfig$Builder;\r\n    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0020\r\n    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ DexOpt: unable to opt direct call 0x0701 at 0x49 in Lcom/mashape/unirest/http/options/Options;.refresh\r\n    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/mashape/unirest/http/options/Options;\r\n    11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ threadid=11: thread exiting with uncaught exception (group=0x416aabd8)\r\n    11-24 16:26:57.496  12605-12856/com.akqa.glass.recipie E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1\r\n        Process: com.akqa.glass.recipie, PID: 12605\r\n        java.lang.RuntimeException: An error occured while executing doInBackground()\r\n                at android.os.AsyncTask$3.done(AsyncTask.java:314)\r\n                at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)\r\n                at java.util.concurrent.FutureTask.setException(FutureTask.java:222)\r\n                at java.util.concurrent.FutureTask.run(FutureTask.java:242)\r\n                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:240)\r\n                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)\r\n                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)\r\n                at java.lang.Thread.run(Thread.java:841)\r\n         Caused by: java.lang.NoClassDefFoundError: org.apache.http.client.config.RequestConfig\r\n                at com.mashape.unirest.http.options.Options.refresh(Options.java:45)\r\n                at com.mashape.unirest.http.options.Options.<clinit>(Options.java:34)\r\n                at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:154)\r\n                at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131)\r\n                at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)\r\n                at com.akqa.glass.recipie.JSONParser.getCamFindJSON(JSONParser.java:41)\r\n                at com.akqa.glass.recipie.RecipIE$CamFindRequest.doInBackground(RecipIE.java:287)\r\n                at com.akqa.glass.recipie.RecipIE$CamFindRequest.doInBackground(RecipIE.java:275)\r\n                at android.os.AsyncTask$2.call(AsyncTask.java:302)\r\n                at java.util.concurrent.FutureTask.run(FutureTask.java:237)\r\n                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:240)\r\n                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)\r\n                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)\r\n                at java.lang.Thread.run(Thread.java:841)\r\n    11-24 16:26:57.520  12605-12860/com.akqa.glass.recipie D/PARSER﹕ Inside Parser\r\n    11-24 16:26:57.520  12605-12860/com.akqa.glass.recipie I/dalvikvm﹕ Rejecting re-init on previously-failed class Lcom/mashape/unirest/http/options/Options; v=0x0\r\n    11-24 16:26:57.528  12605-12860/com.akqa.glass.recipie W/dalvikvm﹕ threadid=13: thread exiting with uncaught exception (group=0x416aabd8)\r\n    11-24 16:26:57.528  12605-12860/com.akqa.glass.recipie I/Process﹕ Sending signal. PID: 12605 SIG: 9\r\n"},"comment":{"url":"https://api.github.com/repos/Mashape/unirest-java/issues/comments/167261217","html_url":"https://github.com/Mashape/unirest-java/issues/53#issuecomment-167261217","issue_url":"https://api.github.com/repos/Mashape/unirest-java/issues/53","id":167261217,"user":{"login":"CrazyPython","id":2363105,"avatar_url":"https://avatars.githubusercontent.com/u/2363105?v=3","gravatar_id":"","url":"https://api.github.com/users/CrazyPython","html_url":"https://github.com/CrazyPython","followers_url":"https://api.github.com/users/CrazyPython/followers","following_url":"https://api.github.com/users/CrazyPython/following{/other_user}","gists_url":"https://api.github.com/users/CrazyPython/gists{/gist_id}","starred_url":"https://api.github.com/users/CrazyPython/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrazyPython/subscriptions","organizations_url":"https://api.github.com/users/CrazyPython/orgs","repos_url":"https://api.github.com/users/CrazyPython/repos","events_url":"https://api.github.com/users/CrazyPython/events{/privacy}","received_events_url":"https://api.github.com/users/CrazyPython/received_events","type":"User","site_admin":false},"created_at":"2015-12-25T20:25:37Z","updated_at":"2015-12-25T20:25:37Z","body":"+1"}}