Android Question [PROBLEM FOUND] Errors after change Http for OkHttp

Discussion in 'Android Questions' started by Walter Adriano da Silva, Jul 27, 2015.

  1. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    Hello

    Once I changed HttpUtils2 with Http to OkHttp the application began to show some errors that were not displayed.

    Errors like:

    "res" is the result from a Single Result Query.

    I think that maybe the change from one library to another isn't the cause for this, but the errors started just after that I made the change.

    Note: If I try use res in log, it's shown normally
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Is this the full error message?
     
  3. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    It looks like a debugging issue. Test it in release mode and see whether it happens.
     
  5. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    I just test
    The app stopped at same moment that debug mode
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload your project (File - Export as zip)?
     
  7. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    Sorry, I can't
    Do you would have another way to check this?
     
  8. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    If I catch this error on try/catch other error is thrown

    This is the full message too. It's the same variable in other place.
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Can you send me the project by mail?
     
  10. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    I need a permission for this.
    For while I'm using the apache-based http library again and the app works now. :confused:
     
  11. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    Project sent by mail.
     
  12. Walter Adriano da Silva

    Walter Adriano da Silva Member Licensed User

    The problem here was incompatibility between OkHttp and Picasso Lib to B4A.

    Follow the stack:
     
  13. KY Leng

    KY Leng Member Licensed User

    URL="http://www.open-electronics.org/celltrack/celltxt.php?hex=0&mcc=456&mnc=1&lac=60102&cid=66011439"
    Job1.Download(URL)

    And I got error as follow:

    > Url: http://www.open-electronics.org/celltrack/celltxt.php?hex=0&mcc=456&mnc=1&lac=60102&cid=66011499
    Error occurred on line: 120 (HttpJob)
    java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest.InitializeGet(java.lang.String)' on a null object reference
    at MPTC.CID.Test.httpjob._download(httpjob.java:100)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5253)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)

    When I pass the URL directly to browser, it work fine.
    So, could you tell me what is the problem ?

    Looking forward to hearing from you soon.
     
  14. DonManfred

    DonManfred Expert Licensed User

    1. You should start a new thread for your question
    2. You should provide more information. Example project which shows the problem.
     
Loading...