Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster.

Related tags

Networking volley
Overview

Volley

Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster.

For more information about Volley and how to use it, visit the Android developer training page.

Comments
  • Volley library not working on Android 9.0

    Volley library not working on Android 9.0

    I have two testing phones one is on 8.1 and the other one is on 9.0 volley is working fine on 8.1 but on 9.0 it's giving null in Volley Error I traced it its network issue. My Volley version is 1.1.1 How can I solve this any help would be appreciated.

    opened by mostafaaddam 25
  • Can't read

    Can't read "contentType" from cache

    I have met a issue , when I try to get the "contentType" from cache, it always return null. Then I checked the source code of "DiskBasedCache" and "BasicNetwork".

    It turns out that in "DiskBasedCache" , the volley use "HaspMap" to save the http headers and in "BasicNetwork" it uses "new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER)" which is not case sensitive.

    So if the server's response header, uses "content-type" rather than "Content-Type", it can work properly with a response from network but can't get contentType from the cache.

    And because of this issue , you can't parse the charset from cache , and it will use the default charset which is "ISO_8859_1" , and if it doesn't match the actually charset which you should get from "content-type" , then you can't get the right response content with the right charset from cache.

    opened by dingbuoyi 23
  • Cache/NetworkDispatcher leaking finished requests

    Cache/NetworkDispatcher leaking finished requests

    Hi Team, com.android.volley.Request#finish is not clearing mErrorListener, not its calling onFinish as is the case with https://github.com/mcxiaoke/android-volley/blob/master/src/main/java/com/android/volley/Request.java finish. due to which error listener is not getting cleared and memory leak is there.

    opened by Dayanand515 19
  • Disable all VolleyLogs

    Disable all VolleyLogs

    Hiding all VolleyLogs by setting VolleyLog.DEBUG to false is not working for all logs. How can we Disable all Logs(Log.e, Log.d etc) from volley. It seems like only the log.v can handle with the VolleyLog.DEBUG key.

    opened by ChristopherPrintuJoseph 17
  • unableto clear mErrorListener causing memory leaked.

    unableto clear mErrorListener causing memory leaked.

    I need to clear error listener after request is cancel (when call onStop()).

    Currently that is no way to clear mErrorListener in Request class, which will cause leaked if the error listener implementation is reference fragment or activity.

    opened by kiwionly 16
  • Added two progress indicators to inform of the upload/download of byt…

    Added two progress indicators to inform of the upload/download of byt…

    Hi,

    That branch provides two listeners in order to follow up on the progress of sending and receiving data.

    Thank you for your time,

    Best regards,

    Nicolas Dagnas

    opened by ndagnas 14
  • Publish to bintray

    Publish to bintray

    Do you know when these recent updates will be included in a build published to jCenter/bintray?

    Currently is the only way to get the "NegativeArraySizeException" update is to pull down the entire project and include/build locally?

    I would rather use the gradle file for including the dependency.

    dependencies { ... compile 'com.android.volley:volley:1.0.0' }

    opened by j-t-h 14
  • OutOfMemoryError and NegativeArraySizeException in DiskBasedCache.streamToBytes

    OutOfMemoryError and NegativeArraySizeException in DiskBasedCache.streamToBytes

    DiskBasedCache may fail repeatedly if a cached header is corrupt. In the event of failure, the most common error is OutOfMemoryError thrown from streamToBytes, caused by trying to allocate a huge number of bytes resulting from the bogus length calculated due to the corruption.

    Once a header has been corrupt, the cache initialization will continue to fail, and the errant header will not be removed.

    A less common failure was NegativeArraySizeException, but that was recently patched.

    DiscBasedCache needs to be updated to guard against corruption.

    Related to:

    https://code.google.com/p/android/issues/detail?id=230219 https://github.com/mcxiaoke/android-volley/issues/141 (mirror) http://stackoverflow.com/a/42196956/901597

    opened by joebowbeer 13
  • Make the dependency on Apache HTTP optional

    Make the dependency on Apache HTTP optional

    Volley currently depends on Apache HTTP. We can mostly remove the dependency except that HttpStack#performRequest returns an org.apache.http.HttpResponse, which means it'd be an API-breaking change to remove.

    It might be worth biting the bullet and just doing a major version bump that breaks the API. There are other known issues that we could potentially address alongside this. However, one avenue worth exploring would be to see if we could treat Apache HTTP as a "provided" dependency - that is, one which is available at compile time, but not runtime - and then deprecate the old performRequest and add a new one that is implemented by all built-in clients (except HttpClientStack, which should be deprecated as well).

    I think the result would compile and let apps build against Volley without pulling in the Apache HTTP dependency, but existing users could continue to use the Apache stack as long as they pulled in the dependency at runtime (and it should be there on an actual Android device).

    Apart from the ugliness, my main concern is how proguard would respond to the missing reference - we could add a consumer proguard rule to not warn on org.apache stuff though that might be a bit overbearing.

    opened by jpd236 12
  • Get Implementation in AsyncCache that takes in a callback function

    Get Implementation in AsyncCache that takes in a callback function

    Implemented the get function in AsyncCache that takes in a callback function in two different ways. In the one (DiskBasedAsyncCache), it uses an asynchronous file channel, and for the fallback version, it works very similarly to the current DiskBasedCache. Most of the code in those files are from that, aside from the get method. There are not tests yet for this, as not enough has really been implemented to test it, but was more to check the direction of the code.

    opened by sphill99 11
  • Fatal Exception: No NameTypeIndex match for SHORT_STANDARD

    Fatal Exception: No NameTypeIndex match for SHORT_STANDARD

    I could not reproduce, but I usually got crash message from Fabric Crashlytics Report.

    Device:

    • Nexus 5X and Nexus 6P. OS version 8.1.0

    Fatal Exception: java.lang.AssertionError: No NameTypeIndex match for SHORT_STANDARD at android.icu.impl.TimeZoneNamesImpl$ZNames.getNameTypeIndex(TimeZoneNamesImpl.java:724) at android.icu.impl.TimeZoneNamesImpl$ZNames.getName(TimeZoneNamesImpl.java:790) at android.icu.impl.TimeZoneNamesImpl.getTimeZoneDisplayName(TimeZoneNamesImpl.java:183) at android.icu.text.TimeZoneNames.getDisplayName(TimeZoneNames.java:261) at java.text.SimpleDateFormat.subFormat(SimpleDateFormat.java:1296) at java.text.SimpleDateFormat.format(SimpleDateFormat.java:1004) at java.text.SimpleDateFormat.format(SimpleDateFormat.java:974) at java.text.DateFormat.format(DateFormat.java:341) at com.android.volley.toolbox.HttpHeaderParser.formatEpochAsRfc1123(SourceFile:152) at com.android.volley.toolbox.BasicNetwork.getCacheHeaders(SourceFile:256) at com.android.volley.toolbox.BasicNetwork.performRequest(SourceFile:130) at com.android.volley.NetworkDispatcher.processRequest(SourceFile:120) at com.android.volley.NetworkDispatcher.run(SourceFile:87)

    pls help do investigation on that crash.

    opened by TuanNA-MTITech 11
  • setPriority() for Request

    setPriority() for Request

    After reading the documentation and looking into the Request.java file, it seems like there is currently no option to easily set the Priority for a Request, neither via Setter or Constructor. Is there any particular reason for this? I already found posts on Stackoverflow on how to get the desired functionality, but as basic as this is, I'm still curious to find out why the 'obvious' way hasn't been implemented, as I guess there is a good reason for it.

    Thanks for any clarification.

    opened by BenjyTec 1
  • The JsonObjectRequest and JsonArrayRequest don't support 204: No Content

    The JsonObjectRequest and JsonArrayRequest don't support 204: No Content

    If the server sends a 204 No Content, Volley still attempts to read the message body, and decode it. It shouldn't, or it should permit an empty body somehow.

    opened by rhbvkleef 5
  • Compiler warning in apps that don't use androidx.annotation:annotation

    Compiler warning in apps that don't use androidx.annotation:annotation

    (Forking from #402)

    When an app depends on Volley (1.2.0+, possibly older as well), and doesn't also depend on androidx.annotation:annotation, the resulting build will have compiler warnings:

    > Task :app:compileReleaseJavaWithJavac
    warning: unknown enum constant Scope.LIBRARY_GROUP
      reason: class file for androidx.annotation.RestrictTo$Scope not found
    

    These are non-fatal by default, but become fatal if -Werror is enabled.

    This doesn't seem to have bothered anyone through now, but it'd be nice to fix. The problem is that neither option seems great. @RestrictTo needs to be retained at class-time, not source-time, so it's technically not safe to depend on as compileOnly. However, androidx.annotation:annotation isn't available on Maven Central, so we'd be requiring a dependency on something that can't actually be obtained there, though in practice this may be perfectly reasonable since you can't build a Google app without artifacts from the Google repository anyway. Removing the annotation wouldn't be ideal since it'd provide no protection (however light) against applications depending on methods meant for internal use in Volley.

    opened by jpd236 1
  • Allow sending any JSON with JsonArrayRequest and JsonObjectRequest

    Allow sending any JSON with JsonArrayRequest and JsonObjectRequest

    Prior to #406, JsonArrayRequest required JSONArray request bodies, and JsonObjectRequest required JSONObject request bodies. Nothing should couple the request type and response type, so it's reasonable to want to send JSONObjects and get back JSONArray, or vice versa. However, the new constructors can end up breaking compilation of existing code which depend on Volley, since the request argument is nullable and thus ambiguous if null is provided. For example, code like:

    JsonObjectRequest request = new JsonObjectRequest(Method.POST, url, null, listener, errorListener);
    

    compiles fine with the current Volley production release, but suddenly fails to compile here since the compiler doesn't know whether this corresponds to the JSONObject or JSONArray constructor.

    I don't see a great, backwards-compatible fix for this. Adding a factory method or builder isn't sufficient because subclassing the request is fairly common too (e.g. to populate custom headers). We could just reorder the arguments in one of them, but that would just make for a more confusing API.

    So I think for the short term, we should just revert back to what was in place before. Longer term, if/when we make breaking API changes, we can consider improvements here.

    The workaround is to extend JsonRequest directly, e.g.:

    public class MyJsonObjectRequest extends JsonRequest<JSONObject> {
        public MyJsonObjectRequest(..., JSONArray request, ...) {
            super(..., request != null ? request.toString() : null, ...);
        }
    
        @Override
        protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
            try {
                String jsonString =
                        new String(
                                response.data,
                                HttpHeaderParser.parseCharset(response.headers, PROTOCOL_CHARSET));
                return Response.success(
                        new JSONObject(jsonString), HttpHeaderParser.parseCacheHeaders(response));
            } catch (UnsupportedEncodingException e) {
                return Response.error(new ParseError(e));
            } catch (JSONException je) {
                return Response.error(new ParseError(je));
            }
        }
    }
    

    or just avoid using these classes entirely - they're not that complex, and you're probably better off using a strongly-typed JSON object instead.

    opened by jpd236 0
  • E/Volley: [42916] NetworkUtility.shouldRetryException: Unexpected response code 403

    E/Volley: [42916] NetworkUtility.shouldRetryException: Unexpected response code 403

    E/Volley: [42916] NetworkUtility.shouldRetryException: Unexpected response code 403 for https://newsapi.org/v2/top-headlines?country=us&category=business&apiKey=271580bf514747cXXXXXXXXXXXXXXXXX

    Code for reference: - https://github.com/msn2106/NewsApp/issues/2

    opened by msn2106 1
Releases(1.2.1)
  • 1.2.1(Aug 25, 2021)

  • 1.2.1-rc1(Aug 10, 2021)

  • 1.2.0(Mar 8, 2021)

    • Ensure ImageListener#onResponse is always invoked (#209)
    • Stricter, more consistent enforcement of disk size limit in DiskBasedCache (#57)
    • Reduce cache churn from large entries
    • Allow specification of default image / error image bitmaps or drawables in NetworkImageView (#227, #243, #267)
    • Add RequestEventListener interface to monitor requests as they are executed (#238)
    • Fix StrictMode violation for disk I/O in Volley#newRequestQueue (#274)
    • Less verbose error logging for commonly-used invalid Expires headers (#282)
    • Ensure If-Modified-Since header is formatted correctly on all devices (#287)
    • Reinitialize DiskBasedCache if directory is deleted (#297)
    • Send request to network if parsing the cache entry fails (#321)
    • Add Nullable annotations (#325, #333)
    • Allow creation of custom input/output streams in HurlStack (#328)
    • Tolerate null header maps in HttpHeaderParser (#334)
    • Add opt-in retries of NoConnectionErrors (#332)
    • Include license in generated POM file (#377)
    • Use a consistent timebase when evaluating soft/hard TTLs (#391)
    • Experimental AsyncRequestQueue interface and Cronet-based implementation (details)

    This release is identical to 1.2.0-rc1.

    Source code(tar.gz)
    Source code(zip)
    volley-1.2.0.aar(151.35 KB)
  • 1.2.0-rc1(Feb 22, 2021)

    • Ensure ImageListener#onResponse is always invoked (#209)
    • Stricter, more consistent enforcement of disk size limit in DiskBasedCache (#57)
    • Reduce cache churn from large entries
    • Allow specification of default image / error image bitmaps or drawables in NetworkImageView (#227, #243, #267)
    • Add RequestEventListener interface to monitor requests as they are executed (#238)
    • Fix StrictMode violation for disk I/O in Volley#newRequestQueue (#274)
    • Less verbose error logging for commonly-used invalid Expires headers (#282)
    • Ensure If-Modified-Since header is formatted correctly on all devices (#287)
    • Reinitialize DiskBasedCache if directory is deleted (#297)
    • Send request to network if parsing the cache entry fails (#321)
    • Add Nullable annotations (#325, #333)
    • Allow creation of custom input/output streams in HurlStack (#328)
    • Tolerate null header maps in HttpHeaderParser (#334)
    • Add opt-in retries of NoConnectionErrors (#332)
    • Include license in generated POM file (#377)
    • Use a consistent timebase when evaluating soft/hard TTLs (#391)
    • Experimental AsyncRequestQueue interface and Cronet-based implementation (details)
    Source code(tar.gz)
    Source code(zip)
    volley-1.2.0-rc1.aar(151.35 KB)
  • 1.1.1(Jul 16, 2018)

    Changes since 1.1.0:

    • Fix incorrect tag in MarkerLog when Request#finish is called from a background thread (#115).
    • Additional fixes for IllegalArgumentExceptions and OutOfMemoryErrors in DiskBasedCache#readHeaderList (#127).
    • Exclude time spent waiting for an item on the request queue when measuring network time in NetworkDispatcher (#140).
    • Prevent spurious wakeups from prematurely finishing a RequestFuture (#162).
    • Fix StrictMode errors when using HurlStack (#138).
    • Improve error messaging and fail more loudly when making unsafe concurrent calls to ImageLoader (#132).
    • Add @Nullable annotations to nullable parameters (#185).
    • Prevent cache collisions between requests using the same URI but different methods (#154).
    • Prevent duplicated/conflicting HTTP headers when using HurlStack (#193).
    • Flesh out RetryPolicy's documentation (#80).
    • Re-raise interrupt flag when quitting dispatcher threads (#60).
    • Improve error message when a null key/value is returned by getParams or getPostParams (#201).

    This release is identical to 1.1.1-rc1.

    Source code(tar.gz)
    Source code(zip)
    volley-1.1.1.aar(96.76 KB)
  • 1.1.1-rc1(Jun 21, 2018)

    • Fix incorrect tag in MarkerLog when Request#finish is called from a background thread (#115).
    • Additional fixes for IllegalArgumentExceptions and OutOfMemoryErrors in DiskBasedCache#readHeaderList (#127).
    • Exclude time spent waiting for an item on the request queue when measuring network time in NetworkDispatcher (#140).
    • Prevent spurious wakeups from prematurely finishing a RequestFuture (#162).
    • Fix StrictMode errors when using HurlStack (#138).
    • Improve error messaging and fail more loudly when making unsafe concurrent calls to ImageLoader (#132).
    • Add @Nullable annotations to nullable parameters (#185).
    • Prevent cache collisions between requests using the same URI but different methods (#154).
    • Prevent duplicated/conflicting HTTP headers when using HurlStack (#193).
    • Flesh out RetryPolicy's documentation (#80).
    • Re-raise interrupt flag when quitting dispatcher threads (#60).
    • Improve error message when a null key/value is returned by getParams or getPostParams (#201).
    Source code(tar.gz)
    Source code(zip)
    volley-1.1.1-rc1.aar(96.76 KB)
  • 1.1.0(Dec 4, 2017)

    Changes since 1.0.0:

    • Apache HTTP is now an optional dependency (#2). See Migrating from Apache HTTP for details on how to avoid using it.
    • Fix OutOfMemoryErrors and NegativeArraySizeExceptions in DiskBasedCache (#12).
    • Fix memory leak in Request#mErrorListener (#15).
    • Support for multiple identical response headers (#21).
    • Fix potential NullPointerException in ImageRequest/JsonRequest/StringRequest (#64).
    • Fix soft TTL for duplicate in-flight requests (#73).
    • Fix case-sensitive header reads from cache (#76).
    • Fix memory leak of last finished request in CacheDispatcher/NetworkDispatcher (#114).

    This release is identical to 1.1.0-rc2.

    Source code(tar.gz)
    Source code(zip)
    volley-1.1.0.aar(94.26 KB)
  • 1.1.0-rc2(Nov 20, 2017)

  • 1.1.0-rc1(Oct 12, 2017)

    • Apache HTTP is now an optional dependency (#2). See Migrating from Apache HTTP for details on how to avoid using it.
    • Fix OutOfMemoryErrors and NegativeArraySizeExceptions in DiskBasedCache (#12).
    • Fix memory leak in Request#mErrorListener (#15).
    • Support for multiple identical response headers (#21).
    • Fix potential NullPointerException in ImageRequest/JsonRequest/StringRequest (#64).
    • Fix soft TTL for duplicate in-flight requests (#73).
    • Fix case-sensitive header reads from cache (#76).
    Source code(tar.gz)
    Source code(zip)
    volley-1.1.0-rc1.aar(93.80 KB)
Owner
Google
Google ❤️ Open Source
Google
The easiest HTTP networking library for Kotlin/Android

Fuel The easiest HTTP networking library for Kotlin/Android. You are looking at the documentation for 2.x.y.. If you are looking for the documentation

Kittinun Vantasin 4.3k Jan 8, 2023
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀

Fast Android Networking Library About Fast Android Networking Library Fast Android Networking Library is a powerful library for doing any type of netw

AMIT SHEKHAR 5.5k Jan 3, 2023
Android Easy Http - Simplest android http request library.

Android Easy Http Library 繁體中文文檔 About Android Easy Http Library Made on OkHttp. Easy to do http request, just make request and listen for the respons

null 13 Sep 30, 2022
LiteHttp is a simple, intelligent and flexible HTTP framework for Android. With LiteHttp you can make HTTP request with only one line of code! It could convert a java model to the parameter and rander the response JSON as a java model intelligently.

Android network framework: LiteHttp Tags : litehttp2.x-tutorials Website : http://litesuits.com QQgroup : 42960650 , 47357508 Android网络通信为啥子选 lite-htt

马天宇 829 Dec 29, 2022
HttpMocker is a simple HTTP mocking library written in Kotlin to quickly and easily handle offline modes in your apps

HttpMocker HttpMocker is a very lightweight Kotlin library that allows to mock HTTP calls relying on either OkHttp or the Ktor client libraries. It ca

David Blanc 174 Nov 28, 2022
Flower - Super cool Android library to manage networking and database caching with ease

Flower Super cool Android library to manage networking and database caching with ease. It allows developers to use remote resources on-the-fly OR Comb

Rajesh Hadiya 192 Dec 26, 2022
:satellite: [Android Library] Simplified async networking in android

Android library that simplifies networking in android via an async http client. Also featured in [Awesome Android Newsletter #Issue 15 ] Built with ❤︎

Nishant Srivastava 36 May 14, 2022
Kotlin-echo-client - Echo client using Kotlin with Ktor networking library

Overview This repository contains an echo server implemented with Kotlin and kto

Elliot Barlas 2 Sep 1, 2022
Android Asynchronous Networking and Image Loading

Android Asynchronous Networking and Image Loading Download Maven Git Features Kotlin coroutine/suspend support Asynchronously download: Images into Im

Koushik Dutta 6.3k Dec 27, 2022
IceNet - Fast, Simple and Easy Networking for Android

IceNet FAST, SIMPLE, EASY This library is an Android networking wrapper consisting of a combination of Volley, OkHttp and Gson. For more information s

Anton Nurdin Tuhadiansyah 61 Jun 24, 2022
Latihan Networking dengan Retrofit

Latihan-Background-Process-dan-Networking-9 Latihan Networking dengan Retrofit Pada materi kali ini Anda akan belajar menggunakan Retrofit untuk menam

Ubean 0 Nov 25, 2021
Asynchronous socket, http(s) (client+server) and websocket library for android. Based on nio, not threads.

AndroidAsync AndroidAsync is a low level network protocol library. If you are looking for an easy to use, higher level, Android aware, http request li

Koushik Dutta 7.3k Jan 2, 2023
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Jan 8, 2023
Monitoring water tanker level using NodeMCU ESP8266 and HC-SR04P Ultrasonic Sensor and broadcasting it using a simple HTTP server inside NodeMCU ESP8266 and show data in an Android App

WaterLevel Preface This project aims to finding a tanker water level using NodeMCU with ESP8266 core and HC-SR04P Ultrasonic sensor and broadcasting i

YaMiN 12 Dec 20, 2022
Kotlin HTTP requests library. Similar to Python requests.

khttp khttp is a simple library for HTTP requests in Kotlin. It functions similarly to Python's requests module. import khttp.get fun main(args: Arra

Anna Clemens 466 Dec 20, 2022
Java HTTP Request Library

Http Request A simple convenience library for using a HttpURLConnection to make requests and access the response. This library is available under the

Kevin Sawicki 3.3k Jan 6, 2023
Unirest in Java: Simplified, lightweight HTTP client library.

Unirest for Java Install With Maven: <!-- Pull in as a traditional dependency --> <dependency> <groupId>com.konghq</groupId> <artifactId>unire

Kong 2.4k Jan 5, 2023
super simple library to manage http requests.

HttpAgent super simple library to manage http requests. Gradle dependencies { implementation 'com.studioidan.httpagent:httpagent:1.0.16@aar' } No

idan ben shimon 32 Oct 24, 2021