http://blog.csdn.net/very_caiing/article/details/46241531java
今天在百度統計看項目上有一個crash比較高的bug:android
Java.lang.NegativeArraySizeException: -1092 at
com.Android.volley.toolbox.DiskBasedCache.streamToBytes(DiskBasedCache.java:322)
at
com.android.volley.toolbox.DiskBasedCache.get(DiskBasedCache.java:118)
at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:100)git
看出是volley的問題,google了一下,發現是volley有這個bug,github上有提到:
https://github.com/mcxiaoke/android-volley/issues/37
修改的代碼以下:
https://github.com/mcxiaoke/android-volley/commit/2f317deb8c9cfdf349a9a3b7a90207c2bf5649b7
大體緣由就是:當去磁盤緩存中找圖片的時候,圖片已經被刪掉了。github
更新Volley庫的時候碰到了很多問題,下面簡單說明一下……緩存
我發現咱們項目中是直接將volley.jar放在libs目錄中,並無將volley整個工程導入進來。因而網上搜索了一下,只須要如下幾步:ruby
$ git clone https://android.googlesource.com/platform/frameworks/volley $ cd volley $ android update project -p . $ ant jar
因而安裝了ant,並把android加入環境變量中,發現仍是不行,會報如下的錯誤:app
Error: D:\github_space\volley is not a valid project
(AndroidManifest.xml not found).gradle
確實是沒有這個文件,因而翻了很久,終於發現如今google已經用gradle來編譯volley了,不是ant了。。。
終於,安裝好gradle,結果,又出現下面的錯誤!!!ui
Gradle version 2.1 is required. Current version is 2.3. If using the
gradle wrapper, try editing the distributionUrl in
/Users/sunbinqiang/development/others/volley/gradle/wrapper/gradle-wrapper.properties
to gradle-2.1-all.zipgoogle
修改了build.gradle裏面的SDK和tools信息,終於看到下面的結果了:
BUILD SUCCESSFUL
而後在」build\intermediates\bundles\release」找到classes.jar, 更名字。
以上。