0
下面三行代碼爲排雷android我正在執行,但我得到一個outofmemory錯誤。Volley初始化錯誤DiskBaseChacke
爲什麼外面顯示。這段代碼有什麼問題。
RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
JsonArrayRequest jsObjRequest = new JsonArrayRequest(url, listener, errorListener);
requestQueue.add(jsObjRequest);
05-08 21:03:00.196: E/dalvikvm-heap(3800): Out of memory on a 536870928-byte allocation.
05-08 21:03:00.196: I/dalvikvm(3800): "Thread-4690" prio=5 tid=11 RUNNABLE
05-08 21:03:00.196: I/dalvikvm(3800): | group="main" sCount=0 dsCount=0 obj=0x42c62c40 self=0x40000948
05-08 21:03:00.196: I/dalvikvm(3800): | sysTid=3816 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1106467000
05-08 21:03:00.196: I/dalvikvm(3800): | state=R schedstat=(35549043 20857416 40) utm=2 stm=1 core=0
05-08 21:03:00.196: I/dalvikvm(3800): at java.util.HashMap.makeTable(HashMap.java:~569)
05-08 21:03:00.196: I/dalvikvm(3800): at java.util.HashMap.<init>(HashMap.java:158)
05-08 21:03:00.196: I/dalvikvm(3800): at com.android.volley.toolbox.DiskBasedCache.readStringStringMap(DiskBasedCache.java:546)
05-08 21:03:00.196: I/dalvikvm(3800): at com.android.volley.toolbox.DiskBasedCache$CacheHeader.readHeader(DiskBasedCache.java:392)
05-08 21:03:00.196: I/dalvikvm(3800): at com.android.volley.toolbox.DiskBasedCache.initialize(DiskBasedCache.java:155)
05-08 21:03:00.201: I/dalvikvm(3800): at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:84)
05-08 21:03:00.201: W/dalvikvm(3800): threadid=11: thread exiting with uncaught exception (group=0x42220700)
05-08 21:03:00.201: E/AndroidRuntime(3800): FATAL EXCEPTION: Thread-4690
05-08 21:03:00.201: E/AndroidRuntime(3800): java.lang.OutOfMemoryError
05-08 21:03:00.201: E/AndroidRuntime(3800): at java.util.HashMap.makeTable(HashMap.java:569)
05-08 21:03:00.201: E/AndroidRuntime(3800): at java.util.HashMap.<init>(HashMap.java:158)
05-08 21:03:00.201: E/AndroidRuntime(3800): at com.android.volley.toolbox.DiskBasedCache.readStringStringMap(DiskBasedCache.java:546)
05-08 21:03:00.201: E/AndroidRuntime(3800): at com.android.volley.toolbox.DiskBasedCache$CacheHeader.readHeader(DiskBasedCache.java:392)
05-08 21:03:00.201: E/AndroidRuntime(3800): at com.android.volley.toolbox.DiskBasedCache.initialize(DiskBasedCache.java:155)
05-08 21:03:00.201: E/AndroidRuntime(3800): at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:84)
你確定?我仍然有這個問題,你可以發佈你的應用程序類嗎? – CQM
https://github.com/ogrebgr/android_volley_examples檢查這個例子。 – Ranjithkumar