NullPointerException at com.android.volley.Request.<init>(Request.java:130)

来源:互联网 发布:网络恐怖主义犯罪案例 编辑:程序博客网 时间:2024/06/05 16:56

今天用volley发现莫名其妙的报 NullPointerException如下图



自己查了自己的变量发现并没有null,偶然发现url是没有域名的(如http://www.baidu.com/index.php只写了/index.php)。问题解决。 volley为什么报NullPointerException  

跟踪到android.volley.Request文件 64行



发现他判断是否url为空 不为空或者空字符,就获取host并hashcode  这里就自然为null  然后 NullPointerException  

搞定。


2 0
原创粉丝点击