您的位置:首页 > 其它

volley使用中问题汇总

2017-07-26 17:55 232 查看

标题

volley.ParseError

com.android.volley.ParseError:
org.json.JSONException:Value indexModule of type java.lang.String connot be converted to JSONObject


服务器返回值不是json格式,而使用了JsonRequest。解决办法,检查后台返回json的合法性;不使用JsonRequest。

If you want to receive the result as a string don’t use the JSONRequest. Go with the simple Request class. Your problem is pretty simple the server is giving back a JSONArray with just one element inside. A JSONArray is not a JSONObject. That’s why the parsing is failing.

如果你想获得的结果作为一个字符串不使用jsonrequest。使用简单请求类。你的问题是很简单的服务器给后面的一个jsonarray只有一个元素里面。一个jsonarray不是JSONObject。这就是解析失败的原因。

volley.NoConnectionError

com.android.volley.NoConnectionError:
java.net.ConnectException:failed to connect to /192.168.0.105(port 80) after 5000ms:isConnected failed:EHOSTUNREACH(No route to host)


无法连接到/ 192.168.0.105(端口80)后5000ms:连接失败:EHOSTUNREACH(没有路由到主机)

服务器相应超时。请检查接口。

标题

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: