不要忘记初始化 xutils 在MyApplication的onCreate方法中添加x.Ext.init(this);
RequestParams params = new RequestParams("地址"); params.setMultipart(true); //这个要设置 params.addBodyParameter("pic", new File("/storage/emulated/0/baofeng/download/middle_ad/973060456.jpg"), "image/jpg",null); x.http().post(params, new Callback.CommonCallback<String>() { @Override public void onSuccess(String result) { Log.e("222",result); } @Override public void onError(Throwable ex, boolean isOnCallback) { Log.e("222","111"); } @Override public void onCancelled(CancelledException cex) { Log.e("222","2"); } @Override public void onFinished() { Log.e("222","321"); } });