Android: Volley 超时崩溃修复

标签 android timeout android-volley connection-timeout acra

我的应用程序因这个 com.android.volley.TimeoutError 崩溃(偶尔)。 您可以在下方看到 stack_trace 和 logcat 输出。

我已经有如下错误处理函数:

private Response.ErrorListener volleyErrorListener = new Response.ErrorListener({
    @Override
    public void onErrorResponse(VolleyError e) {
        stopLoader();
        showToast(Constant.ERROR);
    }
};

(我认为这将处理所有事件,如超时、无连接等)

  1. 您能解释一下为什么会这样吗?
  2. 如何防止我的应用程序崩溃? (任何示例代码将不胜感激)

提前致谢!

ANDROID_VERSION=4.3
PHONE_MODEL=GT-I9300

STACK_TRACE

com.android.volley.TimeoutError
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:123)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:110)

LOGCAT

04-02 18:11:18.405 I/dalvikvm(21976): Could not find method com.google.inject.Injector.getTypeConverterBindings, referenced from method roboguice.inject.ContextScopedRoboInjector.getTypeConverterBindings
04-02 18:11:18.405 W/dalvikvm(21976): VFY: unable to resolve interface method 27646: Lcom/google/inject/Injector;.getTypeConverterBindings ()Ljava/util/Set;
04-02 18:11:18.405 D/dalvikvm(21976): VFY: replacing opcode 0x72 at 0x000c
04-02 18:11:18.560 D/dalvikvm(21976): GC_CONCURRENT freed 884K, 18% free 9573K/11636K, paused 5ms+2ms, total 29ms
04-02 18:11:18.560 D/dalvikvm(21976): WAIT_FOR_CONCURRENT_GC blocked 12ms
04-02 18:11:18.655 D/dalvikvm(21976): GC_CONCURRENT freed 932K, 18% free 9647K/11760K, paused 2ms+9ms, total 28ms
04-02 18:11:18.715 D//Ln.java:218(21976): main Configuring Logging, minimum log level is INFO
04-02 18:11:18.850 I/System.out(21976): Logged In-> null
04-02 18:11:18.880 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:18.885 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:18.885 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:18.890 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:18.935 D/libEGL  (21976): loaded /system/lib/egl/libEGL_mali.so
04-02 18:11:18.945 D/libEGL  (21976): loaded /system/lib/egl/libGLESv1_CM_mali.so
04-02 18:11:18.950 D/libEGL  (21976): loaded /system/lib/egl/libGLESv2_mali.so
04-02 18:11:18.960 E/        (21976): Device driver API match
04-02 18:11:18.960 E/        (21976): Device driver API version: 23
04-02 18:11:18.960 E/        (21976): User space API version: 23 
04-02 18:11:18.960 E/        (21976): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct  9 21:05:57 KST 2013 
04-02 18:11:19.065 D/OpenGLRenderer(21976): Enabling debug mode 0
04-02 18:11:19.090 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:19.090 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:19.090 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:19.095 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:27.845 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:27.850 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:28.255 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:28.255 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:28.750 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:28.755 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:29.770 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:29.775 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:30.260 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:30.260 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:30.675 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:30.680 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:31.020 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:31.020 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:31.180 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:31.185 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:33.500 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:33.500 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:34.640 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:36.705 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:36.755 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:37.140 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:37.140 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:37.610 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:37.615 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:37.885 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:37.885 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:37.925 D/dalvikvm(21976): GC_CONCURRENT freed 1226K, 20% free 9832K/12240K, paused 6ms+2ms, total 32ms
04-02 18:11:38.370 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:38.375 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:38.925 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:39.200 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:39.245 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:39.450 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:39.455 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:39.845 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:39.850 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:42.355 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:42.360 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:42.395 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:42.685 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:42.685 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:42.685 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:42.710 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.070 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.070 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.070 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.095 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.445 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.445 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.445 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.480 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.840 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.840 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.840 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:43.885 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:44.225 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:44.225 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:44.230 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:44.260 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:44.830 D/ProgressBar(21976): setProgress = 0
04-02 18:11:44.830 D/ProgressBar(21976): setProgress = 0, fromUser = false
04-02 18:11:44.830 D/ProgressBar(21976): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 10000
04-02 18:11:44.875 D/dalvikvm(21976): GC_FOR_ALLOC freed 78K, 19% free 9969K/12240K, paused 18ms, total 19ms
04-02 18:11:44.875 I/dalvikvm-heap(21976): Grow heap (frag case) to 11.960MB for 1127536-byte allocation
04-02 18:11:44.895 D/dalvikvm(21976): GC_CONCURRENT freed 1K, 18% free 11068K/13344K, paused 3ms+2ms, total 20ms
04-02 18:11:44.895 D/dalvikvm(21976): WAIT_FOR_CONCURRENT_GC blocked 10ms
04-02 18:11:44.895 D/dalvikvm(21976): WAIT_FOR_CONCURRENT_GC blocked 18ms
04-02 18:11:44.960 D/ProgressBar(21976): updateDrawableBounds: left = 0
04-02 18:11:44.960 D/ProgressBar(21976): updateDrawableBounds: top = 0
04-02 18:11:44.960 D/ProgressBar(21976): updateDrawableBounds: right = 96
04-02 18:11:44.960 D/ProgressBar(21976): updateDrawableBounds: bottom = 96
04-02 18:11:45.745 D/TextLayoutCache(21976): Enable myanmar Zawgyi converter
04-02 18:11:55.635 D/ACRA    (21976): Using custom Report Fields
04-02 18:11:55.675 I/ACRA    (21976): READ_LOGS granted! ACRA can include LogCat and DropBox data.
04-02 18:11:55.695 D/ACRA    (21976): Retrieving logcat output...

最佳答案

当我开始使用 volley 时,我遇到了同样的问题,我从这个 link 下载了 volley后来才知道这不是官方源码,是EDITED源码,而且这个源码的编者根据自己的要求定制了官方源码。 然后我从 official google account 下载了 volley 的实际源代码我所有与 volley 相关的问题现在都已解决。 所以从official google account下载官方源码.

关于Android: Volley 超时崩溃修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29411207/

相关文章:

c# - 计划的 Windows 服务中的一致 FTP 超时

javascript - javascript setInterval 的内存泄漏

java - ExpandableListView 上的 Volley gson 请求导致 java.lang.IndexOutOfBoundsException

php - 如何在 android 中处理远程网站的身份验证?

wcf - Web 服务超时的最佳实践

android - 允许多人登录 Google Play 游戏服务?

java - 将 Java 类转换为 Kotlin

安卓: Volley NoClassDefFoundError

java - 在Sqlite room中写行查询

android - 自定义列表适配器重复条目