B4A Library OkHttp - Replaces the Http library

Bryanne Vega

Member
Licensed User
Longtime User
Does this error only happen on this specific device?
Does it happen with all SSL addresses that you try?

Yes a specific POS Device running their own branded ROM etc etc.
Have not tried others since it's their own HTTPs services.


Maybe if I use :443 port?
 

Blue.Sky

Active Member
Licensed User
Longtime User
I have a problem with below error
java.lang.NoClassDefFoundError: anywheresoftware.b4a.objects.ServiceHelper$StarterHelper
What is problem?
 

rscheel

Well-Known Member
Licensed User
Longtime User
If you used this library OkHttpUtils2.zip should not have problems with Android 6.0.1?

Replace HttpUtils2 by OkHttpUtils2 and I have not had any problem in Android 5.1.1, although I have not had the opportunity to test in 6.0.1.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi all. Time ago i write time ago one library Paypal credit card, now seem that this library have a few problems with SSL, when i call:
B4X:
https://api.sandbox.paypal.com/v1/oauth2/token","grant_type=client_credentials")

find message i have this error:
javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
After i change this line code:
B4X:
Change hc.Initialize in HttpUtils2Service to hc.InitializeAcceptAll
as suggestion Erel HERE

Now i have this error:

Any idea ?
Thank you
Marco
 

sorex

Expert
Licensed User
Longtime User
is the user agent forced/fixed to okhttp/2.4.0 ?

I can't seem to tweak it with the code below.

B4X:
dlj.Download(url)
dlj.GetRequest.SetHeader("User_Agent", "Mozilla/5.0 (Android; Linux armv7l; rv:5.0) Gecko/20110615 Firefox/5.0 Fennec/5.0")
 

DonManfred

Expert
Licensed User
Longtime User
dlj.GetRequest.SetHeader("User_Agent", "Mozilla/5.0 (Android; Linux armv7l; rv:5.0) Gecko/20110615 Firefox/5.0 Fennec/5.0")
have you tried
B4X:
dlj.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Android; Linux armv7l; rv:5.0) Gecko/20110615 Firefox/5.0 Fennec/5.0")
- instead of _
 

sorex

Expert
Licensed User
Longtime User
indeed, I just noticed it. strange because php lists it with an underscore. anyway, it works now.
 

DonManfred

Expert
Licensed User
Longtime User
https://tools.ietf.org/html/rfc7231
 

Bel

Member
Licensed User

I cannot use okhttputil
I used picasso and com.jeremyfeinstein.slidingmenu in project
I didn't have a problem in httputill2 but now i need to use okhttputill it get below error
Please help
java.lang.NoClassDefFoundError: com.squareup.okhttp.HttpResponseCache
 

Bel

Member
Licensed User
Can you post the full error message from the logs?
yes
Below error :
 

Bel

Member
Licensed User
There are several other errors here. Try it in a new project with only OkHttpUtils2 checked.
I dont have problem in new project.it's working good
But in current project have error
How solve it?
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm getting errors once I switched httputils2 to this

 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…