未知主机名例外。 loopj库

时间:2018-03-16 11:43:48

标签: java android put loopj

我正在使用loopj库来上传多个表单数据,但问题是它给了我java.io.UnknownHost异常,虽然我尝试了与postman相同的查询并且它成功提交了数据。 请帮助我解决问题,这是淹死我。

  public void submit() {
            progressDialog.setMessage("Please Wait,  Inserting Data on Server");
            progressDialog.show();

            File myFile = new File(selectedImageUri.getPath().toString());
            RequestParams params = new RequestParams();
            try {
                params.put("image", myFile);
                params.put("id", "" +104);
                params.put("latitude", "33333");
                params.put("longitude", "55555");
                params.put("task_status", "3");
                params.put("remarks", "dilievered");

            } catch (FileNotFoundException e) {

            }
            AsyncHttpClient client = new AsyncHttpClient();
            client.setTimeout(60000);
            client.put(ProcessTask.this,WebServicesURLS.UPDATE_TASK, params, new AsyncHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
                    progressDialog.dismiss();
                    Toast.makeText(ProcessTask.this, "Succesfuly updated", Toast.LENGTH_SHORT).show();
                }

                @Override
                public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
                    progressDialog.dismiss();
                    Toast.makeText(ProcessTask.this, "Failed"+statusCode, Toast.LENGTH_SHORT).show();
                }
            });
        }

logcat image.....

1 个答案:

答案 0 :(得分:0)

您的网址格式错误。请检查在WebServicesURLS.UPDATE_TASK引用下是否有正确的URL。