Http Status Code in Android Volley when error.networkResponse is null

前端 未结 8 1156
忘了有多久
忘了有多久 2020-11-29 00:44

I am using Google Volley on the Android platform. I am having a problem in which the error parameter in onErrorResponse is returning a null n

8条回答
  •  星月不相逢
    2020-11-29 00:44

    I handle this problem manually:

    1. Download Volley library from github and add into AndroidStudio project

    2. Go to com.android.volley.toolbox.HurlStack class

    3. Find setConnectionParametersForRequest(connection, request); line inside of performRequest method

    4. And finally add this codes belew of setConnectionParametersForRequest(connection, request); line :

    // for avoiding this exception : No authentication challenges found
            try {
                connection.getResponseCode();
            } catch (IOException e) {
                e.printStackTrace();
            }
    

提交回复
热议问题