{"action":"created","issue":{"url":"https://api.github.com/repos/Kong/unirest-java/issues/53","repository_url":"https://api.github.com/repos/Kong/unirest-java","labels_url":"https://api.github.com/repos/Kong/unirest-java/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/Kong/unirest-java/issues/53/comments","events_url":"https://api.github.com/repos/Kong/unirest-java/issues/53/events","html_url":"https://github.com/Kong/unirest-java/issues/53","id":49963540,"node_id":"MDU6SXNzdWU0OTk2MzU0MA==","number":53,"title":"Unable to find CloseableHttpClient","user":{"login":"tortilaman","id":5018268,"node_id":"MDQ6VXNlcjUwMTgyNjg=","avatar_url":"https://avatars2.githubusercontent.com/u/5018268?v=4","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,"assignees":[],"milestone":null,"comments":12,"created_at":"2014-11-25T00:52:48Z","updated_at":"2018-07-10T21:31:12Z","closed_at":null,"author_association":"NONE","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:\n\n```\npackage com.akqa.glass.recipie;\n\nimport android.util.Log;\n\nimport com.mashape.unirest.http.HttpResponse;\nimport com.mashape.unirest.http.JsonNode;\nimport com.mashape.unirest.http.Unirest;\nimport com.mashape.unirest.http.exceptions.UnirestException;\n\nimport org.json.JSONException;\nimport org.json.JSONObject;\n\nimport java.io.BufferedReader;\nimport java.io.File;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\n\n//import org.apache.http.HttpResponse;\n//import org.shaded.apache.http.HttpHeaders;\n\npublic class JSONParser {\n    static InputStream is = null;\n    static JSONObject jObj = null;\n    static String json = \"\";\n    private static final String TAG = JSONParser.class.getSimpleName();\n    // constructor\n    public JSONParser() {\n    }\n    public JSONObject getCamFindJSON(String type, String input) {\n        Log.d(\"PARSER\", \"Inside Parser\");\n        /*\n         *  Request processing from API\n         */\n        if(type == \"request\"){\n            try {\n                HttpResponse<JsonNode> response = Unirest.post(\"https://camfind.p.mashape.com/image_requests\")\n                .header(\"X-Mashape-Key\", \"Fhn5jZi5ixmshwnJMy7CGyj5yDCnp15DTQZjsniuwpVHfYHvFJ\")\n                .field(\"image_request[image]\", new File(input))\n                .field(\"image_request[language]\", \"en\")\n                .field(\"image_request[locale]\", \"en_US\")\n                .asJson();\n            } catch (UnirestException e) {\n                Log.d(TAG, \"Couldn't get request\");\n                e.printStackTrace();\n            }\n        }\n        /*\n         *  Receive response from API\n         */\n        else if(type == \"response\"){\n            try {\n                HttpResponse<JsonNode> response = Unirest.get(\"https://camfind.p.mashape.com/image_responses/\" + input)\n                .header(\"X-Mashape-Key\", \"Fhn5jZi5ixmshwnJMy7CGyj5yDCnp15DTQZjsniuwpVHfYHvFJ\")\n                .asJson();\n            } catch (UnirestException e) {\n                Log.d(TAG, \"Couldn't get reponse\");\n                e.printStackTrace();\n            }\n        }\n        /*\n         *  Parse Response into readable JSON\n         */\n        try {\n            BufferedReader reader = new BufferedReader(new InputStreamReader(\n                    is, \"iso-8859-1\"), 8);\n            StringBuilder sb = new StringBuilder();\n            String line = null;\n            while ((line = reader.readLine()) != null) {\n                sb.append(line + \"n\");\n                Log.d(\"Raw Data\", line);\n            }\n            is.close();\n            json = sb.toString();\n        } catch (Exception e) {\n            Log.e(\"Buffer Error\", \"Error converting result \" + e.toString());\n        }\n        // try parse the string to a JSON object\n        try {\n            jObj = new JSONObject(json);\n        } catch (JSONException e) {\n            Log.e(\"JSON Parser\", \"Error parsing data \" + e.toString());\n            e.printStackTrace();\n        } catch (Exception e) {\n            Log.e(\"JSON Parse\", \"Unknown Error\");\n            e.printStackTrace();\n        }\n        // return JSON String\n        return jObj;\n    }\n}\n```\n\nHere is the logcat output:\n\n```\n11-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\n11-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;\n11-24 16:26:57.473  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x1f at 0x0006\n11-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\n11-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\n11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0012\n11-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\n11-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\n11-24 16:26:57.481  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0021\n11-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\n11-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;\n11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0020\n11-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\n11-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;\n11-24 16:26:57.489  12605-12856/com.akqa.glass.recipie W/dalvikvm﹕ threadid=11: thread exiting with uncaught exception (group=0x416aabd8)\n11-24 16:26:57.496  12605-12856/com.akqa.glass.recipie E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1\n    Process: com.akqa.glass.recipie, PID: 12605\n    java.lang.RuntimeException: An error occured while executing doInBackground()\n            at android.os.AsyncTask$3.done(AsyncTask.java:314)\n            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)\n            at java.util.concurrent.FutureTask.setException(FutureTask.java:222)\n            at java.util.concurrent.FutureTask.run(FutureTask.java:242)\n            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:240)\n            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)\n            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)\n            at java.lang.Thread.run(Thread.java:841)\n     Caused by: java.lang.NoClassDefFoundError: org.apache.http.client.config.RequestConfig\n            at com.mashape.unirest.http.options.Options.refresh(Options.java:45)\n            at com.mashape.unirest.http.options.Options.<clinit>(Options.java:34)\n            at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:154)\n            at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131)\n            at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)\n            at com.akqa.glass.recipie.JSONParser.getCamFindJSON(JSONParser.java:41)\n            at com.akqa.glass.recipie.RecipIE$CamFindRequest.doInBackground(RecipIE.java:287)\n            at com.akqa.glass.recipie.RecipIE$CamFindRequest.doInBackground(RecipIE.java:275)\n            at android.os.AsyncTask$2.call(AsyncTask.java:302)\n            at java.util.concurrent.FutureTask.run(FutureTask.java:237)\n            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:240)\n            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)\n            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)\n            at java.lang.Thread.run(Thread.java:841)\n11-24 16:26:57.520  12605-12860/com.akqa.glass.recipie D/PARSER﹕ Inside Parser\n11-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\n11-24 16:26:57.528  12605-12860/com.akqa.glass.recipie W/dalvikvm﹕ threadid=13: thread exiting with uncaught exception (group=0x416aabd8)\n11-24 16:26:57.528  12605-12860/com.akqa.glass.recipie I/Process﹕ Sending signal. PID: 12605 SIG: 9\n```\n"},"comment":{"url":"https://api.github.com/repos/Kong/unirest-java/issues/comments/403972569","html_url":"https://github.com/Kong/unirest-java/issues/53#issuecomment-403972569","issue_url":"https://api.github.com/repos/Kong/unirest-java/issues/53","id":403972569,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzk3MjU2OQ==","user":{"login":"benlevine13","id":29783139,"node_id":"MDQ6VXNlcjI5NzgzMTM5","avatar_url":"https://avatars3.githubusercontent.com/u/29783139?v=4","gravatar_id":"","url":"https://api.github.com/users/benlevine13","html_url":"https://github.com/benlevine13","followers_url":"https://api.github.com/users/benlevine13/followers","following_url":"https://api.github.com/users/benlevine13/following{/other_user}","gists_url":"https://api.github.com/users/benlevine13/gists{/gist_id}","starred_url":"https://api.github.com/users/benlevine13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlevine13/subscriptions","organizations_url":"https://api.github.com/users/benlevine13/orgs","repos_url":"https://api.github.com/users/benlevine13/repos","events_url":"https://api.github.com/users/benlevine13/events{/privacy}","received_events_url":"https://api.github.com/users/benlevine13/received_events","type":"User","site_admin":false},"created_at":"2018-07-10T21:31:12Z","updated_at":"2018-07-10T21:31:12Z","author_association":"NONE","body":"+1"}}
{"actor":{"display_login":"benlevine13"}}