Android Question B4A 12.20 and Android 4.4

Pesciolina

Active Member
Licensed User
Unfortunately I have several outdated devices and I need to update the App.
The App compiled with B4A 12.2 crashes when started on Android 4.4.
To be able to see the error I tried to start it in debug mode on A 4.4 and I get the error I am attaching.
I state that with the B4A 11.8 version and previous sdk it worked correctly.
Thanks for your help

B4X:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="31"/>
 

Attachments

  • errore Android 4.4.txt
    5.1 KB · Views: 40

Star-Dust

Expert
Licensed User
Longtime User
OkHttppUtils library needs a newer version of Android (5+)
To work on version 4 you must use the old HttpUtils version if available.
 
Upvote 0

Gianni Sassanelli

Active Member
Licensed User
Longtime User
Download and install B4A 11.2: https://www.b4x.com/android/forum/t...android-4-1-or-android-4-2.141656/post-897911
It will be installed under Program Files (x86).
Copy all files with okhttp in their names to B4A 12.20 installation folder
Hi Erel,
your solution obviously works fine,
but,
is it possible to find a solution to compile by making sure that if the application runs on android 4.4 it uses the old version of the okHttp library and instead uses the new version on android releases higher than 4.4?
Thank you
hi Erel,
 
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
Hi Erel,
your solution obviously works fine,
but,
is it possible to find a solution to compile by making sure that if the application runs on android 4.4 it uses the old version of the okHttp library and instead uses the new version on android releases higher than 4.4?
Thank you
hi Erel,
Latest okHttp library include support only for android 5+. And B4A uses latest versions.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Oof good thing i saw this. I almost updated B4A, but i still have a large fleet of digital signage running on 4.X
 
Upvote 0

Gianni Sassanelli

Active Member
Licensed User
Longtime User
L'ultima libreria okHttp include il supporto solo per Android 5+. E B4A utilizza le versioni più recenti.
a solution could be to include 2 libraries
http_old
http_last
in the code I could use a TRY CATCH or test the android release and correctly instantiate the object

do you think it is possible to do this?
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
n the code I could use a TRY CATCH or test the android release and correctly instantiate the object
In the code you can use
B4X:
Phone.SDKVersion 'Phone library
to detect if OS version is older or newer than a certain version.
 
Upvote 0

Gianni Sassanelli

Active Member
Licensed User
Longtime User
In the code you can use
B4X:
Phone.SDKVersion 'Phone library
to detect if OS version is older or newer than a certain version.
i know but i don't know ho to use 2 version of some library.
my questio is: Is possible rename the old version of Okhttp library in OKhttp_4.4 library and use it in addiction with new okattp library in the last version?
If this is possible i write my code as following :
B4X:
if phone.SDKVersion = 16 then 
dim oh as okhttp_old
else 
dim oh as okhttp
end
but i don't kno hot to rename the library as i wont
 
Upvote 0

Gianni Sassanelli

Active Member
Licensed User
Longtime User
This is not possible and is not really needed. You can continue to use the old library with new devices.
ok Erel
I didn't want to miss out on the new library features on new devices.
In fact I have several projects and only on a couple I need to support android 4.4
On new projects the minimum requirements are android 6.0

Thanks as always for your support
 
Upvote 0
Top