DS 1.82 not usable for Android 4.x versions?

149 views
Skip to first unread message

Jo Elegolo

unread,
Apr 27, 2020, 4:33:46 AM4/27/20
to DroidScript
Hi!
It seems to me that by DS 1.82 the minimum supported Android version will be 5.x ?
Regarding my problems with DS 1.80 trying to get it run on Kitkat versions without any solution, so still using DS 1.78, there seems to be no hope to get any newer DS running on my "old" Galaxy TABs. Is that right?

Steve Garman

unread,
Apr 27, 2020, 4:36:30 AM4/27/20
to DroidScript
The manifest minSdkVersion has been increased to 21 (Android 5.0) in version 1.82 and later of DroidScript.

The main effects of this are described below.

If you are developing on a KitKat or older device, you will not be able to update to the latest version of DroidScript from Google Play Store but the latest release will be available from http://androidscript.org/apk/

If you install it on older versions of Android there is no guarantee that everything will work as expected. 

Assuming your development device uses Android 5.0 (Lollipop) or later, any APKs built will, by default, be downloadable from Google Play on devices running on Lollipop or later but you can lower or raise the minSdkVersion using a build.json file to target older devices if you wish.

If you lower the minSdkVersion you must test your app on any old versions you are permitting. 
Of course it has always been good practice to test on all versions of Android you are targeting before releasing your app anyway.

The background to this is that versions of Android older than 5.0 have ageing versions of JavaScript V8 that remain stuck in the past.

From 5.0 onward, V8 is regularly updated and we can reasonably assume up-to-date JavaScript will be available and consistent.

This change takes us over the hump from one to the other and there are no plans to increase the minSdkVersion again in the immediate or foreseeable future.

Gautam Mehta

unread,
Jun 13, 2021, 5:06:23 AM6/13/21
to DroidScript
Hi
I was recently testing my spk on different devices to make sure everything was ok.

When I tried it on an old Lenovo tab(model: Lenovo TB3-710F. and Android version: 5.0.1), it didn't run well. First of all, the DS home screen was also not being displayed properly.
(Screenshot attached)

Also, my spk started to run but closed with an error that said MyArray.includes(blah_blah) is not a function. This usually happens when the array is not defined. To make sure my code is correct, I tested it on a recent Android mobile device and it worked flawlessly.

So now are DS apps now not supported in Android 5 anymore?

Screenshot_2021-06-11-18-53-52.png


Gautam Mehta

unread,
Jun 14, 2021, 1:27:59 AM6/14/21
to DroidScript
Please help someone...

Dave

unread,
Jun 14, 2021, 7:17:20 AM6/14/21
to DroidScript
You might need to update your Android WebView to get rid if the error you are seeing which is due to the string.includes method not being supported by the older system WebView.

Alternatively you could put the following code into your main js file to add support for string.includes:-

if (!String.prototype.includes) 
{
    String.prototype.includes = function (search, start) {
        'use strict';
        if (typeof start !== 'number') {
            start = 0;
        }

        if (start + search.length > this.length) {
            return false;
        } else {
            return this.indexOf(search, start) !== -1;
        }
    };
}



Gautam Mehta

unread,
Jun 14, 2021, 12:32:28 PM6/14/21
to DroidScript
Yes, older webview version was the issue. Fixed by updating. But is there a way to detect this, like how can we always ensure that webview has the minimum compatible version.?

Gautam Mehta

unread,
Jun 14, 2021, 12:38:28 PM6/14/21
to DroidScript

One solution that I see is adding this to main.js:

app.SetOnError() {
    app.Alert("Your Webview version is old. Please update it to continue using the app");
    app.Exit();
}

But i dont think this is the ideal solution as the error may be due to something else also.

And suprisingly, the layout issue still persists...

Alan Hendry

unread,
Jun 16, 2021, 7:13:58 AM6/16/21
to DroidScript
Hi,
OnError is triggered by any error, you could check the Android version inside the OnError
    if  (app.GetOSVersion() < 21)
      app.Alert("Your Webview version is old. Please update it to continue using the app");
If a javascript error occurs then you could use a try-catch
On my Alba 8 inch tablet in portrait the DS Home page doesn't show the left and right icons,
you could try turning the device to landscape.
Regards, ah

Steve Garman

unread,
Jun 16, 2021, 7:43:35 AM6/16/21
to DroidScript
unfortunately app GetOSVersion() does not change when System Webview is updated

I recommend

if  (!String.prototype.includes)
      app.Alert("Your Webview version is old. Please update it to continue using the app");

Gautam Mehta

unread,
Jun 16, 2021, 11:07:34 AM6/16/21
to DroidScript
Okay so the final compiled solution would be like:

app.SetOnError() {
    if (!String.prototype.includes)
      app.Alert("Your Webview version is old. Please update it to continue using the app");
      app.Exit();
Reply all
Reply to author
Forward
0 new messages