Skip to content

Frequently Asked Questions

Jeff Davidson edited this page Oct 11, 2019 · 9 revisions

Why doesn't Volley support large downloads/uploads?

Volley is not suitable for large download or streaming operations, since Volley holds all requests and responses in memory during parsing. For large download operations, consider using an alternative like DownloadManager.

This also explains why Volley will run out of memory if you try to use it for a large request/response, and why Volley doesn't expose an API to get the progress of an individual in-flight request or pause/resume in-flight requests.

This decision is fundamental to Volley's architecture, as it simplifies the API for most operations which have small requests/responses, and cannot be changed to support streaming.

Why are network requests failing when I set targetSdkVersion = 28 (Android P) or higher?

Android as a whole has disabled cleartext requests - that is, those using HTTP but not HTTPS - by default for any app which sets targetSdkVersion to 28 or higher. This is not specific to Volley; it applies to any network requests your app may be making.

If migrating to HTTPS-only requests is not an option for your use case, please see the network security configuration documentation for how to whitelist some or all cleartext HTTP requests for your app.

Is Volley asynchronous or synchronous?

The app-facing API for making requests is asynchronous. You add requests to the queue and the provided response listener will be invoked when the request completes.

Some of Volley's internals are synchronous when it comes to dispatching the requests, but for most applications this would not be a major concern. If you are dispatching many parallel requests or are severely memory constrained, then Volley's design may not be ideal because the number of cache and network threads is fixed, and the threads remain idle as long as the RequestQueue is started. Fixing this is on the roadmap, but from the app's perspective this shouldn't result in any changes to the API surface unless you're making custom HTTP stacks or cache implementations.

In the meantime, you may consider using Cronet, which offers a fully asynchronous HTTP stack, if this is critical to your use cases.

How can I use prerelease versions of Volley?

Snapshot builds are automatically generated for every commit to Volley's master branch and published to JFrog's snapshot repository. You can add this repository to your build.gradle configuration with:

repositories {
    maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}

and then change your dependency to com.android.volley:volley:VERSION, where VERSION is the most recent version available in the snapshot repository.

Clone this wiki locally