问题描述
在完成请求后尝试重复请求时,如果已启用调试(log.tag.Volley VERBOSE),则Volley库将引发IllegalStateException,因为VolleyLog.Marker被标记为已完成.如果禁用调试,一切都很好.
When trying to repeat a request after it has completed the Volley library throws an IllegalStateException if you have debug enabled (log.tag.Volley VERBOSE) because VolleyLog.Marker is marked as finished. If you disable the debug everything is fine.
我需要重复请求,因为我使用的api具有api令牌,并且如果请求返回TOKEN_EXPIRED HTTP状态代码,则需要刷新令牌并重复完全相同的请求.我不想再次构造请求.
I need to repeat a request because the api I am using has an api token and if a request returns a TOKEN_EXPIRED HTTP status code I need to refresh the token and repeat the exact same request. I don't want to construct the request again.
是否存在已知的解决方法?
Is there a known workaround?
推荐答案
我找到了一个解决方案:禁用所有截击调试日志.
I found a solution: Disable all volley debug logs.
VolleyLog.DEBUG = false;
这篇关于Volley错误:启用详细日志记录时重复请求失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!