Android Question HttpUtils2 & BASIC auth?

cenyu

Active Member
Licensed User
Longtime User
Hello,
I am using B4A ver. 11.80 and HttpUtils2 ver. 2.10
I have to create a simple app to open one relay by calling http://192.168.0.10:80/on. But there is a BASIC auth.
How to send username and password i read from DonManfred on this post.

When i try i get an error:
B4X:
Logger connected to:  Xiaomi M2010J19SY
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_button1_click (java line: 386)
java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/RequestBody;
    at anywheresoftware.b4a.samples.httputils2.httpjob._class_globals(httpjob.java:54)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.samples.httputils2.httpjob.innerInitialize(httpjob.java:24)
    at anywheresoftware.b4a.samples.httputils2.httpjob._initialize(httpjob.java:180)
    at b4a.example.main._button1_click(main.java:386)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:7515)
    at android.view.View.performClickInternal(View.java:7492)
    at android.view.View.access$3600(View.java:841)
    at android.view.View$PerformClick.run(View.java:28726)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:236)
    at android.app.ActivityThread.main(ActivityThread.java:8107)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: java.lang.ClassNotFoundException: okhttp3.RequestBody
    ... 22 more


I already execute Jetifyer but no success.
Can you help me?
 

Attachments

  • 2022-07-13 09-54-36.png
    2022-07-13 09-54-36.png
    125.8 KB · Views: 27
Last edited:

cenyu

Active Member
Licensed User
Longtime User
Dear DonManfred,
I try with okhttputils2.
EVERYTHING WORK!

You are the best! Thank you
 
Upvote 0
Top