VolleyPlus : NetworkDispatcher.run: Unhandled exception java.lang.NullPointerException

前端 未结 4 730
春和景丽
春和景丽 2021-01-18 01:09

I am trying to run below code:

Map requestMap = new HashMap<>();
Long unixTime = System.currentTimeMillis() / LONG_1000;
requestM         


        
4条回答
  •  走了就别回头了
    2021-01-18 01:50

    I traced the stacktrace and I believe that the root cause is response.headers is null in the method parseNetworkResponse for some reason. I would suggest the following to confirm this.

    1. Create a class that extends StringRequest
    2. In this class override the 'parseNetworkResponse()`. It should look as follows:

         protected Response parseNetworkResponse(NetworkResponse response) {
                Log.d("Response Header = " + response.headers);
                super.parseNetworkResponse(response);
         }
      
    3. Use this class instead of StringRequest.

    Once done, see if the headers is null or not. That should narrow down the problem. By the way, which version of Volley are you using. I never encountered such a problem.

提交回复
热议问题