udg Expert Licensed User Longtime User Aug 19, 2022 #1 Hi all. I have an old widget of mine running on an Android 4.4 device. I have to update it now, but I recall something changed in the underlying lib which causes current OkHttpUtils working from Android 5 up. So my question is: which is the latest B4A version sporting a copy of OkHttpUtils compatible with Android 4 devices? I plan to copy it to the Additonal Libs folder (while changing its name) and select it when compiling for my old device. For newer devices I will instead select the lib included in the installed IDE. TIA
Hi all. I have an old widget of mine running on an Android 4.4 device. I have to update it now, but I recall something changed in the underlying lib which causes current OkHttpUtils working from Android 5 up. So my question is: which is the latest B4A version sporting a copy of OkHttpUtils compatible with Android 4 devices? I plan to copy it to the Additonal Libs folder (while changing its name) and select it when compiling for my old device. For newer devices I will instead select the lib included in the installed IDE. TIA
JakeBullet70 Well-Known Member Licensed User Longtime User Aug 20, 2022 #2 B4A 11.2 has what you need. Upvote 0
udg Expert Licensed User Longtime User Aug 20, 2022 #3 I tried but failed. I will spend some more time when returning from my vacation. What failed so far was: 1. Take OkHttpUtils.b4xlib from B4 11.00 installation 2. Unzip it, modified its Manifest in order to use A4_okhttp (the renamed OkHttp version from B411 Libraries) 3. Zipped again as A4_OkHttpUtils.b4xlib The above resulted in object httpjob unknown. Same if the code from the b4xlib is used as moduless added to the widget. As said, I'm ready to spend a few days out, so no time to investigate further today. Upvote 0
I tried but failed. I will spend some more time when returning from my vacation. What failed so far was: 1. Take OkHttpUtils.b4xlib from B4 11.00 installation 2. Unzip it, modified its Manifest in order to use A4_okhttp (the renamed OkHttp version from B411 Libraries) 3. Zipped again as A4_OkHttpUtils.b4xlib The above resulted in object httpjob unknown. Same if the code from the b4xlib is used as moduless added to the widget. As said, I'm ready to spend a few days out, so no time to investigate further today.
JakeBullet70 Well-Known Member Licensed User Longtime User Aug 20, 2022 #4 I used these from the older B4A version OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar Upvote 0
I used these from the older B4A version OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar
udg Expert Licensed User Longtime User Aug 20, 2022 #5 Thank you. I am not sure anymore about my exact steps.. Probably I missed the proper okio-* jar or simply messed with a few attempts based on other old installations. Anyway, I'm ready to leave now; my widget can wait Upvote 0
Thank you. I am not sure anymore about my exact steps.. Probably I missed the proper okio-* jar or simply messed with a few attempts based on other old installations. Anyway, I'm ready to leave now; my widget can wait
udg Expert Licensed User Longtime User Aug 20, 2022 #6 One last comment before leaving. I suspect that in some way my original plan is lacking something important. There's something ringing in my head telling me that I skipped a step or two. I'm sure @Erel will amend the whole process I described for those lacking an old copy of B4A (firing B4A 11.0 with its OkHttpUtils2 v. 2.96, everything compiles and works ok). My attempt was to prepare an eviroment for the latest B4A release where we could compile for our old Android 4 devices (for what concerns okhttp & friends). Upvote 0
One last comment before leaving. I suspect that in some way my original plan is lacking something important. There's something ringing in my head telling me that I skipped a step or two. I'm sure @Erel will amend the whole process I described for those lacking an old copy of B4A (firing B4A 11.0 with its OkHttpUtils2 v. 2.96, everything compiles and works ok). My attempt was to prepare an eviroment for the latest B4A release where we could compile for our old Android 4 devices (for what concerns okhttp & friends).
JakeBullet70 Well-Known Member Licensed User Longtime User Aug 21, 2022 #7 My B4A 11.8 is just set with the older libs for Android 4. If I want the new libs I have to copy / delete by hand. I can see your idea of having a way to switch easily. Upvote 0
My B4A 11.8 is just set with the older libs for Android 4. If I want the new libs I have to copy / delete by hand. I can see your idea of having a way to switch easily.
incendio Well-Known Member Licensed User Longtime User Aug 22, 2022 #8 JakeBullet70 said: I used these from the older B4A version OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar Click to expand... How exactly you do it? I tried this 1. rename these files, add prefix old- 2. copy it to additional lib 3. change manifest.txt from file OkHttpUtils2.b4xlib into like this Version=2.96 B4A.DependsOn=old-OkHttp, StringUtils B4J.DependsOn=jStringUtils, old-OkHttp B4i.DependsOn=iHttp, iStringUtils Still got the same error. The strange thing is, my app doesn't include OKHttp Library(see attachment) but error point to that library. Attachments SS.png 15.3 KB · Views: 610 Upvote 0
JakeBullet70 said: I used these from the older B4A version OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar Click to expand... How exactly you do it? I tried this 1. rename these files, add prefix old- 2. copy it to additional lib 3. change manifest.txt from file OkHttpUtils2.b4xlib into like this Version=2.96 B4A.DependsOn=old-OkHttp, StringUtils B4J.DependsOn=jStringUtils, old-OkHttp B4i.DependsOn=iHttp, iStringUtils Still got the same error. The strange thing is, my app doesn't include OKHttp Library(see attachment) but error point to that library.
JakeBullet70 Well-Known Member Licensed User Longtime User Aug 22, 2022 #9 I did this. Copy these original files from the 'internal' libs folder to a backup folder (B4A 11.8) OkHttp.jar OkHttp.xml okhttp-4.9.0.jar OkHttpUtils2.b4xlib okio-2.8.0.jar Then copy these older files to the 'internal' libs folder (B4A 11.2) OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar I did NOT edit any manifest files. Last edited: Aug 23, 2022 Upvote 0
I did this. Copy these original files from the 'internal' libs folder to a backup folder (B4A 11.8) OkHttp.jar OkHttp.xml okhttp-4.9.0.jar OkHttpUtils2.b4xlib okio-2.8.0.jar Then copy these older files to the 'internal' libs folder (B4A 11.2) OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar I did NOT edit any manifest files.
JakeBullet70 Well-Known Member Licensed User Longtime User Aug 22, 2022 #10 incendio said: The strange thing is, my app doesn't include OKHttp Library(see attachment) but error point to that library. Click to expand... If one lib is a dependency of another lib it seems to not show up. Upvote 0
incendio said: The strange thing is, my app doesn't include OKHttp Library(see attachment) but error point to that library. Click to expand... If one lib is a dependency of another lib it seems to not show up.
incendio Well-Known Member Licensed User Longtime User Aug 23, 2022 #11 JakeBullet70 said: I did this. Copy these original files from the 'internal' libs folder to a backup folder OkHttp.jar OkHttp.xml okhttp-4.9.0.jar OkHttpUtils2.b4xlib okio-2.8.0.jar Then copy these older files to the 'internal' libs folder OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar I did NOT edit any manifest files. Click to expand... That's do the trick, thanks. Anyway, I will keep old OkHttp library from B4A 11.2 in B4A 11.8. Seem don't need new OkHttp Library. Upvote 0
JakeBullet70 said: I did this. Copy these original files from the 'internal' libs folder to a backup folder OkHttp.jar OkHttp.xml okhttp-4.9.0.jar OkHttpUtils2.b4xlib okio-2.8.0.jar Then copy these older files to the 'internal' libs folder OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar I did NOT edit any manifest files. Click to expand... That's do the trick, thanks. Anyway, I will keep old OkHttp library from B4A 11.2 in B4A 11.8. Seem don't need new OkHttp Library.
scsjc Well-Known Member Licensed User Longtime User Sep 1, 2022 #12 JakeBullet70 said: I did this. Copy these original files from the 'internal' libs folder to a backup folder (B4A 11.8) OkHttp.jar OkHttp.xml okhttp-4.9.0.jar OkHttpUtils2.b4xlib okio-2.8.0.jar Then copy these older files to the 'internal' libs folder (B4A 11.2) OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar I did NOT edit any manifest files. Click to expand... test solution, and work perfectly Upvote 0
JakeBullet70 said: I did this. Copy these original files from the 'internal' libs folder to a backup folder (B4A 11.8) OkHttp.jar OkHttp.xml okhttp-4.9.0.jar OkHttpUtils2.b4xlib okio-2.8.0.jar Then copy these older files to the 'internal' libs folder (B4A 11.2) OkHttp.jar OkHttp.xml okhttp-3.12.12.jar OkHttpUtils2.b4xlib okio-1.17.5.jar I did NOT edit any manifest files. Click to expand... test solution, and work perfectly
udg Expert Licensed User Longtime User Sep 2, 2022 #13 @Erel: : can you briefly explain why it didn't suffice to copy (from an earlier version of B4A's Internal libs) the above listed files to current Additional folder? I seem to recall that Additional supersedes Internal when it finds identical named files. In my original attempt I avoided same-name files at all renaming OkHttp to A4OkHttp and OkHttpUtils2 to A4OkHttpUtils2 (changing its Manifest accordingly), but failed. I ask this to have a better understanding of the inner workings of those libs and their relations. I guess OkHttpUtils makes use of OkHttp which in turn calls okhttp-x.y.z and finally okio-x1.y1.z1 Is there anything hard-coded which prevents the simple copy into Additional folder of older libs to work? Again, @JakeBullet70 's solution works well (as much as having installed an old copy of the B4A IDE), so this post is just to heighten my knowledge. As a wish, you may want to make it available a lib encompassing all that is needed to compile for Android 4 devices. It will be useful for those not having an earlier B4A version handy. Yes, I know where the Wish section is in our Forum TIA Upvote 0
@Erel: : can you briefly explain why it didn't suffice to copy (from an earlier version of B4A's Internal libs) the above listed files to current Additional folder? I seem to recall that Additional supersedes Internal when it finds identical named files. In my original attempt I avoided same-name files at all renaming OkHttp to A4OkHttp and OkHttpUtils2 to A4OkHttpUtils2 (changing its Manifest accordingly), but failed. I ask this to have a better understanding of the inner workings of those libs and their relations. I guess OkHttpUtils makes use of OkHttp which in turn calls okhttp-x.y.z and finally okio-x1.y1.z1 Is there anything hard-coded which prevents the simple copy into Additional folder of older libs to work? Again, @JakeBullet70 's solution works well (as much as having installed an old copy of the B4A IDE), so this post is just to heighten my knowledge. As a wish, you may want to make it available a lib encompassing all that is needed to compile for Android 4 devices. It will be useful for those not having an earlier B4A version handy. Yes, I know where the Wish section is in our Forum TIA
DonManfred Expert Licensed User Longtime User Sep 2, 2022 #14 udg said: files to current Additional folder? Click to expand... okhttputils is an internal library and all the files should be copied to the internal library folder Upvote 0
udg said: files to current Additional folder? Click to expand... okhttputils is an internal library and all the files should be copied to the internal library folder
udg Expert Licensed User Longtime User Sep 2, 2022 #15 My point was that, as far as I recall, when you have two version of the same lib (same name), the one in the Additional should supersedes the one in Iternal. In my attempt I changed the name of the one put in the Additional folder so (it was my goal) the two could coexist. But something seems to prevent the correct working of the files copied in the Additional folder. Upvote 0
My point was that, as far as I recall, when you have two version of the same lib (same name), the one in the Additional should supersedes the one in Iternal. In my attempt I changed the name of the one put in the Additional folder so (it was my goal) the two could coexist. But something seems to prevent the correct working of the files copied in the Additional folder.
DonManfred Expert Licensed User Longtime User Sep 2, 2022 #16 udg said: as far as I recall, when you have two version of the same lib (same name), the one in the Additional should supersedes the one in Iternal Click to expand... internal libs have preference for B4X as far as i remember. Upvote 0
udg said: as far as I recall, when you have two version of the same lib (same name), the one in the Additional should supersedes the one in Iternal Click to expand... internal libs have preference for B4X as far as i remember.
udg Expert Licensed User Longtime User Sep 2, 2022 #17 So, is it the other way around? Internal prevails on Additional? Ok, this explains the case where the name are unchanged. But there should be more to prevent the successful coexistence of two versions of the same lib when they have different names (one in Internal and the other one in Additional). Do you have any previous experience on it? Any hint? TIA Upvote 0
So, is it the other way around? Internal prevails on Additional? Ok, this explains the case where the name are unchanged. But there should be more to prevent the successful coexistence of two versions of the same lib when they have different names (one in Internal and the other one in Additional). Do you have any previous experience on it? Any hint? TIA
Erel B4X founder Staff member Licensed User Longtime User Sep 4, 2022 #18 udg said: So, is it the other way around? Internal prevails on Additional? Click to expand... True. If the libraries and their dependencies have different names then it will work. Upvote 0
udg said: So, is it the other way around? Internal prevails on Additional? Click to expand... True. If the libraries and their dependencies have different names then it will work.
udg Expert Licensed User Longtime User Sep 4, 2022 #19 Thank you, @Erel. So this means that originally I messed up somehow with the libs naming Can you please confirm that the following should work? Applied to a copy of the old libraries in Additional folder Rename OkHttp (jar and xml) - e.g. A4OkHttp Modify OkHttpUtils2's Manifest in order to depend on that newly named okhttp (e.g. A4OkHttp) Rename OkHttpUtils2 - e.g A4OkHttpUtils2 okhttp-3.12.12.jar - unchanged since its name doesn't conflict with new lib okio-1.17.5.jar - same as above If the above is correct, when in a need to compile for Android4 devices I will select A4OkHttpUtils otherwise the standard (and alaways updated with the IDE) OkHttpUtils. TIA Upvote 0
Thank you, @Erel. So this means that originally I messed up somehow with the libs naming Can you please confirm that the following should work? Applied to a copy of the old libraries in Additional folder Rename OkHttp (jar and xml) - e.g. A4OkHttp Modify OkHttpUtils2's Manifest in order to depend on that newly named okhttp (e.g. A4OkHttp) Rename OkHttpUtils2 - e.g A4OkHttpUtils2 okhttp-3.12.12.jar - unchanged since its name doesn't conflict with new lib okio-1.17.5.jar - same as above If the above is correct, when in a need to compile for Android4 devices I will select A4OkHttpUtils otherwise the standard (and alaways updated with the IDE) OkHttpUtils. TIA
scsjc Well-Known Member Licensed User Longtime User Sep 4, 2022 #20 Erel said: True. If the libraries and their dependencies have different names then it will work. Click to expand... I rename the files and copy inside internal, and work fine. Attachments _A4OkHttp_sdk19.rar _A4OkHttp_sdk19.rar 503.3 KB · Views: 612 Upvote 0
Erel said: True. If the libraries and their dependencies have different names then it will work. Click to expand... I rename the files and copy inside internal, and work fine.