我在用OkHttp在AndroiStudio中写一个登录请求时,不通过,就报错
下面是报错信息,也不是红色字体的
W/System.err: com.alibaba.fastjson.JSONException: syntax error, pos 1, line 1, column 2CLEARTEXT communication to www.hnsaturn.com not permitted by network security policy
下面是控制台指引的代码行
private void showUI(final String message) {
//开启新线程
runOnUiThread(new Runnable() { //开启UI线程,更新组件信息
@Override
public void run() {
try {
JSONObject jsonObject=JSONObject.parseObject(message);
//toJavaObject 是转换为java对象
ResponseEntity responseEntity = JSON.toJavaObject(jsonObject, ResponseEntity.class);
//显示历史记录 用 append 否则用setText
textView.append(responseEntity.getSmsHead()+"\n"+responseEntity.getSmsBody()+"\n");
} catch (Exception e) {
e.printStackTrace();
textView.setText("请求数据失败:"+e.getMessage()+"\n");
}
}
});