B4J Question Compiled library not working?

notedop

Member
Licensed User
Longtime User
Hi,

I have updatec the OkHttpUtils2 library where as the httpjob now has an additional class global Map called ResponseHeaders. The ResponseHeaders are filled by the hc_ResponseSuccess sub.

When using the class modules directly in my project all works fine, however when compiling to a library it seems that the code stops somewhere.

So I've added some additional logging to the subs to see if they are being triggered.
I'm using httpjob.Download.

When running the project as a non-compiled library the result is as following:

B4X:
Waiting for debugger to connect...
Program started.
httpjob: Initializing
Utils2Service: Initializing
Utils2Service: working
Utils2Service: working
Utils2Service: working
Utils2Service: working
Utils2Service: Initialized
httpjob: Initialize complete
httpjob: Download
httpjob: Download end
Utils2Service: SubmitJob
Utils2Service: SubmitJob (MyMap) {1=[jobname=openurl, success=false, username=
, password=, errormessage=, responseheaders=(MyMap) {}
, target=class b4j.example.main, taskid=, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@2d363fb3
, tag=java.lang.Object@7d6f77cc, fx=anywheresoftware.b4j.objects.JFX@5aaa6d82, main=null
, httputils2service=null]}
Utils2Service: SubmitJob executetrue
Utils2Service: SubmitJob end
Utils2Service: hc_ResponseSuccess
Utils2Service: hc_ResponseSuccess end
Utils2Service: Response_StreamFinish
Utils2Service: CompleteJob
Utils2Service: CompleteJob end
Utils2Service: Response_StreamFinish end
[jobname=openurl, success=true, username=
, password=, errormessage=, responseheaders=(MyMap) {cache-control=[private], content-type=[text/html; charset=utf-8], date=[Sat, 17 Jun 2017 13:23:10 GMT], server=[Microsoft-IIS/8.5], vary=[Accept-Encoding], x-aspnet-version=[4.0.30319], x-powered-by=[ASP.NET]}
, target=class b4j.example.main, taskid=1, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@2d363fb3
, tag=java.lang.Object@7d6f77cc, fx=anywheresoftware.b4j.objects.JFX@5aaa6d82, main=null
, httputils2service=null]

However when running the same MAIN however having the modules added as a compiled library it, it stops after Download End. It seems that the Callsubdelayed is not being processed but I have no idea why this is.

The compiled library is added to my customs library function.
I've updated the library name and version numbers so I can keep track of it.

Allthough I have a work-around, i'm keen to understand why the compiled to library version of the code is not working.

B4X:
Waiting for debugger to connect...
Program started.
Open Page
httpjob: Initializing
Utils2Service: Initializing
Utils2Service: working
Utils2Service: working
Utils2Service: working
Utils2Service: working
Utils2Service: Initialized
httpjob: Initialize complete
httpjob: Download
httpjob: Download end
 

Attachments

  • jOkHttpUtils2_UI_HEADERS.jar
    8 KB · Views: 184
  • jOkHttpUtils2_UI_HEADERS.xml
    11.4 KB · Views: 280
  • okhttputils_UI_HEADERS.zip
    4.3 KB · Views: 201

notedop

Member
Licensed User
Longtime User
Strange, I thought I had taken that into account... I'll give it another try tonight and see what happens.
 
Upvote 0

notedop

Member
Licensed User
Longtime User
BTW @Erel the version provided by the b4j installer is version 2.4 however the source code version available in the ok Httputill2 forum thread contains a lower version. I believe it was 2.3 if I'm not mistaken. Is there an updated source code version which has not been shared yet? And If so what are the differences and can you share the latest?
 
Upvote 0

notedop

Member
Licensed User
Longtime User
>> not current anymore: I have no idea what i'm doing now differently compared to when I tried it the first time, but it's working now. Still wondering about the 2.40 source code version though.

update: I've updated another project with the newly compiled library and then i''m seeing the same behaviour again.

So when I compile the source code, remove the class modules, add the library, then it's working. But when I add the library to another project then it stops within the httpjob class module
 
Last edited:
Upvote 0

notedop

Member
Licensed User
Longtime User
The difference between both is that the original source code is a non_UI and the other project where it's not working is an UI project.

I've redownloaded the non-ui source code, made the adjustments I needed to do to retrieve the headers, set the build configuation to UI, added the JFX library, compiled the library, imported it into the UI project. Result: not working.

Went back to the library source code, removed the class modules, added the compiled UI library and ran the NON-UI project - which is working.

no idea what i;m doing wrong here as I explicitly compiled it as UI but the library is only working with a non-ui project.
 
Upvote 0

notedop

Member
Licensed User
Longtime User
ok, that worked o_O
created a blank UI project
imported the class module of the sourcecode of the non_ui okhttputils2 library including the code module
made the required adjustments
compiled as library
imported into other UI project and tadaa ;)

thanks
 
Upvote 0
Top