android Volley library NegativeArraySizeException

不想你离开。 提交于 2019-12-22 10:52:45

问题


I'm getting this NegativeArraySizeException from Volley library. This error started after I changed Volley android-library-module to a maven dependencies like compile 'com.android.volley:volley:1.0.0'

I've this singleton pattern and I change the addToRequestQueue method to avoid double request bug with following link:

public <T> void addToRequestQueue(Request<T> req) {
        req.setRetryPolicy(new DefaultRetryPolicy(
                0,
                DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
                DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        getRequestQueue().add(req);
    }

I see that official Android-Volley does not getting any updates. So Do I have to change it back what it was? Or is there any way to fix this bug? Thanks in advance.

Fatal Exception: java.lang.NegativeArraySizeException: -603989761
       at com.android.volley.toolbox.DiskBasedCache.streamToBytes(DiskBasedCache.java:323)
       at com.android.volley.toolbox.DiskBasedCache.readString(DiskBasedCache.java:541)
       at com.android.volley.toolbox.DiskBasedCache.readStringStringMap(DiskBasedCache.java:563)
       at com.android.volley.toolbox.DiskBasedCache$CacheHeader.readHeader(DiskBasedCache.java:404)
       at com.android.volley.toolbox.DiskBasedCache.initialize(DiskBasedCache.java:157)
       at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:84)

来源:https://stackoverflow.com/questions/40318347/android-volley-library-negativearraysizeexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!