NegativeArraySizeException in mopub-volley 1.1.0, bundled with mopub-android-sdk 3.13.0



Getting some crash reports from users about NegativeArraySizeException.

java.lang.NegativeArraySizeException: -749
       at com.mopub.volley.toolbox.DiskBasedCache.streamToBytes(
       at com.mopub.volley.toolbox.DiskBasedCache.get(

I think it’s been fixed by other people in various Volley forks. I don’t keep up with Volley, so don’t know if it’s fixed in the official repo.

Example fix:


Removing the word “occasional” from the title, because this is now apparently among my top 2 crashes in my app.


Hi @talklittle,

Thank you for raising this issue and for linking to a viable fix.

I have added those details to the open NegativeArraySizeException ticket in our internal ticketing system.

Are you using the open source SDK or the Fabric Kit Library?


Hi @JeffreyCarlson I am using the open-source MoPub SDK via Gradle dependency:

(Sorry for late reply, I didn’t see your comment until now.)


Hi @talklittle - Apologies for the late reply myself. I was hoping to have additional news but a fix has taken on a larger scope.

Our team is actively discussing the appropriate next steps for updating volley which involves support for Android M in addition to this fix.

Since you are using the open source version, one “right now” option is making a quick fork of and merging in the necessary changes from the library to resolve your crash.

We’ll follow up when this issue has been resolved officially by MoPub.

Also for future support needs, in addition to posting here, I recommend sending an email to That email feeds directly into the MoPub specific ticket queue and will provide an additional level of visibility to any issues you are experiencing.