Android Question Error in ExecuteQuery function from DBRequestManager

Bernard Harris

Member
Licensed User
Hello, I am updating an app I created in 2018. The app does SQL queries to a remote server and once I upgraded B4A I also had to copy the HTTP.jar/.xml and HttpUtils2.jar/xml into the Libraries folder because they weren't there with the new version of B4A. I'm now getting a strange error when performing the ExecuteQuery function in DBRequestManager.

It's at this statement in ExecuteQuery where it gets the error:
j.PostBytes(link & "?method=query", ms.ToBytesArray)

And the error I get is:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/methods/HttpPost;

Do I need to upgrade the code or use some newer methods to make this work? Just looking for help on understanding what might have changed with the newer version of B4A.

Sorry but it's been a while since the app was written and it's been working fine but we need to upgrade.
 

DonManfred

Expert
Licensed User
Longtime User
HttpUtils2.jar/xml
REMOVE THEM! They are deprecated SINCE YEARS now!
Use okhttputils2 and okhttp (they are already in the internal library folder....
 
Upvote 1

Bernard Harris

Member
Licensed User
Okay, I replaced that file with the OKHttpUtils2 and it went further but I'm now getting a strange error and I think it's from the remote server.

The error is:
ResponseError. Reason: java.net.UnknownServiceException: CLEARTEXT communication to 71.13.118.169 not permitted by network security policy, Response:
Error: java.net.UnknownServiceException: CLEARTEXT communication to 71.13.118.169 not permitted by network security policy

I am not running CLEARTEXT anywhere so now wondering what would cause this error. Thanks!
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
CLEARTEXT communication to 71.13.118.169 not permitted by network security policy, Response
Solution: Use HTTPS-URLs

Alternative
Add
B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)
to your Manifest.
 
Upvote 1

Bernard Harris

Member
Licensed User
Thanks! I just read about that in the forum and added it. But now I get a different error.

ResponseError. Reason: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter source, Response:
Error: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter source
HandleJob: 1
 
Upvote 0
Top