Android Question Http Client ClientProtocolException not found

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
why do I get this error?
I updated the Http library to OkHttp, but still I have this.


B4X:
main.java:360: error: cannot access ClientProtocolException
_hc.Initialize("hc");
              ^
  class file for org.apache.http.client.ClientProtocolException not found
 

deantangNYP

Active Member
Licensed User
Longtime User
Encountered same error after upgrading to v6.0.
B4X:
src\flm\b4a\floatwin\main.java:513: error: cannot access ClientProtocolException
_hc_file.Initialize("hc");
                   ^
  class file for org.apache.http.client.ClientProtocolException not found

What do you mean switch to OkHttpUtils2? Switch what to OkHttpUtils2? Many Thanks

When i include OkHttpUtils2 Library.
i get this error.
B4X:
Error description: HttpUtils2Service is declared twice. You should either remove the library reference or the code module.
 
Last edited:
Upvote 0

deantangNYP

Active Member
Licensed User
Longtime User
Encountered same error after upgrading to v6.0.
B4X:
src\flm\b4a\floatwin\main.java:513: error: cannot access ClientProtocolException
_hc_file.Initialize("hc");
                   ^
  class file for org.apache.http.client.ClientProtocolException not found

What do you mean switch to OkHttpUtils2? Switch what to OkHttpUtils2? Many Thanks

When i include OkHttpUtils2 Library.
i get this error.
B4X:
Error description: HttpUtils2Service is declared twice. You should either remove the library reference or the code module.

Solved by downgrading to \android-21\android.jar
 
Upvote 0

deantangNYP

Active Member
Licensed User
Longtime User
This is the wrong solution.

You need to remove HttpJob and HttpUtils2Service modules and add a reference to OkHttpUtils2.

Removed the HttpJob and HttpUtils2Service modules and add a reference to OkHttpUtils2.

But error still persist.

B4X:
hc_file.Initialize(\
javac 1.7.0_51
src\flm\b4a\floatwin\main.java:503: error: cannot access ClientProtocolException
_hc_file.Initialize("hc");
                   ^
  class file for org.apache.http.client.ClientProtocolException not found
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

deantangNYP

Active Member
Licensed User
Longtime User
you are still using old http code... Have you replaced http With okHTTP too?

i should change this as well? Change HttpClient to OkHttpClient?

B4X:
Dim hc_file As HttpClient

I am using the following few libraries. Please advise. Thanks
 

Attachments

  • CaptureLib.JPG
    CaptureLib.JPG
    15.5 KB · Views: 666
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top