-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Volley library not working on Android 9.0 #235
Comments
I'm having the same issue. Getting an error like this: |
Hi @mostafaaddam |
@rahulupadhyay thank you I did what you said I lowered my build tool version and the compiled version to 27 and it worked so the problem is from android 9.0 or 28 Volley is yet not compatible. |
Can someone attach an example project which breaks when building with compileSdkVersion 28? It is working fine for me. The stack trace in the above comment doesn't make sense, because line 148 of HurlStack has nothing to do with ProtocolVersion - are you using an older version of Volley? In general Apache HTTP has been removed from Android 9. You might be hitting this: https://developer.android.com/about/versions/pie/android-9.0-changes-all#apache-nonp |
I could not reproduce this issue with v1.1.1 nor v1.1.0 when targetSdk=28. If you want a simple project using v1.1.1 with targetSdk=28, here is one. |
Funny thing I posted this last month and had my issue instantly closed... But Im glad its getting attention. My project has been on hold because of this. |
I've made an example app below showing Volley can load image on Android 8.1 but not on Android 9. Haven't got time investigating it but suspect cache control issue.... |
A similar problem here. My app has been working fine until the first install in a v9.0 today (a Huawei Mate 20). My app has stopped connecting to my server using Volley: String LOGIN_URL = "http://xxx.dyndns-ip.com:50547/../login.php"; ---> Triggers the "onErrorResponse". |
It seems like a number of potential issues have come up here - let me try my best to address them all. @arachaic your issue (#226) was closed because I do not believe it to be an issue specific to Volley, but rather any network-using app that targets API level 28 or higher. Cleartext traffic is disabled by default for such apps; you either need to switch to HTTPS everywhere or opt out for any cleartext sites you'd like to access. Please see this doc for more details. Also note that while I do take an aggressive approach to closing issues when I believe they are fully addressed, I mean no personal offense by doing this, and I am always happy to reopen issues if more details can be provided that merit investigation. @mktsui Based on the issue description you appear to be running into the same issue. The image that fails to load is at an HTTP URL; the one that succeeds is an HTTPS URL. If you would like to be able to access HTTP URLs, you will need a network policy that permits it as this is disabled by default when apps target SDK 28 or above. (Of course, you should try to avoid HTTP URLs for security/privacy reasons if it is feasible to do so). @salvagp7500 there's not enough information for us to investigate here from this alone. What I'd recommend you do is file a separate bug with more details, ideally including sample code, and the logs, including the full stack trace of the error passed to onErrorResponse. You should also mention whether this is specific to this particular device or if it can be reduced on an Android emulator, as this could be an OEM-specific issue on Huawei devices; I can't say from what's been provided here. I've added an FAQ about this here: https://github.com/google/volley/wiki/Frequently-Asked-Questions#why-are-network-requests-failing-when-i-set-targetsdkversion--28-android-p-or-higher I'm going ahead and closing this issue out as I believe there are no pending issues here. But as always, if you are running into a problem, please file a bug with the details needed for us to reproduce or at least investigate, and we'll be happy to take a look. |
com.android.volley.VolleyError: java.lang.RuntimeException: Stub! Adding a network security config did not help. |
I have yet to get a project that reproduces that issue, but I believe the most likely reason is that you have two versions of Volley in your classpath, one of which is older and depends on Apache HTTP. Make sure you are using Volley 1.1.1 and no other versions due to other dependencies. |
its solution is here |
I use this code that below here Step 1 create xml folder into res folder at android project Step 2 create one file into xml folder like below: #########################################
######################################### Step 3 in AndroidManifest.xml < application happy code |
Android 6.0 release removes support for the Apache HTTP client. If your app is using this client and targets Android 2.3 (API level 9) or higher, use the HttpURLConnection class instead. This API is more efficient because it reduces network use through transparent compression and response caching, and minimizes power consumption. To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file: android { |
for this issue i use https |
Yeah changing to https for my websites fixed it for me. |
http://www....... |
On android 9.0 need to add network security config. You can take a look in here: https://stackoverflow.com/a/53928030/4180169 And details in here: https://developer.android.com/training/articles/security-config#manifest It fixes the problem. Hope, it'll be helpful. |
Hi I keep getting this error on Volley 1.1.1 |
add this line in manifests file |
Just for the record if anybody runs into this: I got a simiar error when What's different is, that I use my own HttpStack httpStack = HttpProxyMgr.getHttpStack();
fReqQueue = Volley.newRequestQueue(context, httpStack); In this case, After changing the code to HurlStack httpStack = HttpProxyMgr.getHttpStack();
fReqQueue = Volley.newRequestQueue(context, httpStack); a different constructor is used and everything works fine. In this case, no |
hi thanks for suggestion i will try it but i just need to send token how to
do that grtHeader not helping
…On Fri, Aug 30, 2019 at 6:56 PM skypal ***@***.***> wrote:
Just for the record if anybody runs into this: I got a simiar error when
targetSdkVersion=28. (class ProtocolVersion not found in
BaseHttpStack.performRequest)
What's different is, that I use my own HttpStack (derived from HurlStack)
to implement HTTP Proxy access. The code looks as follows:
HttpStack httpStack = HttpProxyMgr.getHttpStack();
fReqQueue = Volley.newRequestQueue(context, httpStack);
lead in using a deprecated constructor for BasicNetwork that in result
will use AdaptedHttpStack which itself is derived from BaseHttpStack. The
AdaptedHttpStack delegates the exequteRequest to
BaseHttpStack.performRequest which tries to create a ProtocolVersion("HTTP",
1, 1) which then results in the ClassNotFoundException.
After changing the code to
HurlStack httpStack = HttpProxyMgr.getHttpStack();
fReqQueue = Volley.newRequestQueue(context, httpStack);
everything works fine. In this case, no AdaptedHttpStack is used
inbetween and no BaseHttpStack.performRequest is called anymore, so no
ClassNotFoundException
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#235?email_source=notifications&email_token=AH3DR53DDILVHQZVPQUYBTTQHEUXZA5CNFSM4F73UTBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5RZZVI#issuecomment-526621909>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH3DR57BJWBRIACEDX4B5WLQHEUXZANCNFSM4F73UTBA>
.
|
if you upgrade the volley library to 1.1.0, its solves the error |
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.
The text was updated successfully, but these errors were encountered: