javascriptlets do not work anymore

168 views
Skip to first unread message

Zoltan Fazekas

unread,
Apr 26, 2016, 6:04:14 AM4/26/16
to Tasker
I am developing an app with Tasker since months and export it as APK using the factory. Since yesterday, the exported APK shows the following error message at each Javascriptlet task: Uncaught TypeError: Object [object Object] has no method ... The name of the method varies depending on what Javascript function is called within the Javascriptlet. This error begun to appear after upgrading Tasker to the newest version 4.8u2.

Does the error have to do with the upgrade?

Thanx!

Pent

unread,
Apr 26, 2016, 6:32:56 AM4/26/16
to Tasker
Works fine in Tasker ?

Pent

Zoltan Fazekas

unread,
Apr 26, 2016, 7:52:28 AM4/26/16
to Tasker
Yes, works fine in Tasker. Only the generated/exported APK does not work.

Thx, Zoltan

Bjorn T

unread,
Apr 27, 2016, 6:17:28 PM4/27/16
to Tasker

I also discovered problems with javascript after updating to 4.8u2, I use a script in a task that calculates sunrise and sunset (http://tasker.wikidot.com/sunrisesunset). The script calculates sunrise, sunset and twilight times on a given position, the output are 8 variables, but after the update not all of the variables get a value in Tasker. I'm however only intrested in two values (sunrise and sunset) so I simply typed a double slash in front of the other calculations and then the sunset and sunrise variables get values,if I let all the eight variables be calculated only sunrise and a couple of other variables are assigned values, not sunset. 

So it seems that the problem has to do with the number of variables being calculated.

Pent

unread,
Apr 28, 2016, 7:46:37 AM4/28/16
to Tasker
I tested:

JavaScriptlet, var ttt = 3; callVol( ttt, true, true )
Flash %ttt

Which worked OK, so the basic mechanism and calling Tasker functionality is working.

You will need to try and find yourself exactly which part is failing or tell me
a particular function which is failing.

Pent

Bjorn T

unread,
Apr 28, 2016, 9:20:47 AM4/28/16
to Tasker

I am telling you that this particular function is failing to give values to more than three variables: http://tasker.wikidot.com/sunrisesunset. As I wrote it calculates in all 8 variables, but only three get values. Fortunately I only need two values so I remove (disable by making them comments) the other five variables. And what I'm trying to explain is that it can calculate any two or three of these variable if I remove the others, just not all at once. So after updating to 4.8u2 there is all of a sudden a limit for how many variable a javascript can assign values to.

Zoltan Fazekas

unread,
Apr 28, 2016, 10:59:30 AM4/28/16
to Tasker
In my "old" project, wenn exported as an APK, no javascript works since the update to 4.8u2. It makes not difference what Javascript function is called. I built in this single-line Javascriptlet (with the Auto-Exit option being on) as the very first action to start with:

flash("123");

After installing and starting the APK, I got the following error message:

Javascriptlet: line 2: Uncaught TypeError: Object [object Object] has no method 'exit'

But when I created a new project with a Javascriptlet as the only action in it, its exported APK worked fine. It seems like the APK export goes wrong for my old project but not for the new one.

Zoltan 

Zoltan Fazekas

unread,
Apr 28, 2016, 11:02:16 AM4/28/16
to Tasker
I am not using any variables in my Javascriptlet and get the error message explained above...

Zoltan Fazekas

unread,
Apr 28, 2016, 11:04:56 AM4/28/16
to Tasker
BTW, I have found one more post describing the same problem: https://groups.google.com/forum/#!topic/tasker/MwsoAF0k3pk

Zoltan

Pent

unread,
Apr 28, 2016, 12:41:25 PM4/28/16
to Tasker
Zoltan, Could you send me the project XML of the project which has the task with just the flash function in it ?

You can remove all the other stuff if you want (but please test that it still doesn't work after doing that).

Bjorn, sorry, I was replying to Zoltan previously as his case seems the easiest to analyse.

Thanks,

Pent

Bjorn T

unread,
Apr 28, 2016, 1:41:56 PM4/28/16
to Tasker
Bjorn, sorry, I was replying to Zoltan previously as his case seems the easiest to analyse.

Thanks,

Pent

Ok

Thanks 
,
Björn

Zoltan Fazekas

unread,
Apr 28, 2016, 6:30:42 PM4/28/16
to Tasker
Yes, of course. I have attached the XML as well as the exported APK (I don't know if you need it). If I can provide you with any other information, please let me know.

Thanks!
Zoltan
dimory.prj.xml
dimory.373.apk

alex f

unread,
Apr 29, 2016, 2:38:01 AM4/29/16
to Tasker
Same zoltan errors for me with javascript action

Pent

unread,
Apr 29, 2016, 2:16:14 PM4/29/16
to Tasker
Which is the task with the flash function only ?

Pent

Angela Slaney

unread,
Apr 29, 2016, 2:45:47 PM4/29/16
to Tasker
I run sunriseset daily too. It works without problem for me.

On Thursday, 28 April 2016 14:20:47 UTC+1, Bjorn T wrote:

I am telling you that this particular function is failing to give values to more than three variables: http://tasker.wikidot.com/sunrisesunset. [snip]

Zoltan Fazekas

unread,
Apr 29, 2016, 2:57:06 PM4/29/16
to Tasker
The task the APK starts with is called "Start Visible". The first action in this task is the Javascriptlet with the flash function. But I did not remove the other actions from this task or the other tasks from the project. If I should, just let me know. 

Pent

unread,
Apr 29, 2016, 3:22:34 PM4/29/16
to Tasker
Works OK here.

Have you tried a reinstall ?

Had a ROM update lately ?

Pent

Zoltan Fazekas

unread,
Apr 29, 2016, 3:58:06 PM4/29/16
to Tasker
I just reinstalled the APK again on two different Android phones it used to work on before. On both I get the Javascript error after starting the APK. There was no ROM update.

Does the APK really work on your phone? Or does the task "Start Visible" only work within Tasker?

Zoltan Fazekas

unread,
Apr 29, 2016, 4:24:50 PM4/29/16
to Tasker
Pent, I compared the APKs exported before and after the Tasker update to 4.8u2. The versions of the APK exported during the last 4 weeks before the Tasker update were all 2.4 MB large. The APKs exported after the Tasker update were suddenly 2.9 MB large, but I made only minimal modifications (no really new features) compared to the last version before the Tasker update. Does this help in your investigations? Should I send you an APK exported before the Tasker update?


Am Freitag, 29. April 2016 21:22:34 UTC+2 schrieb Pent:

Bjorn T

unread,
Apr 29, 2016, 4:27:19 PM4/29/16
to Tasker
Den fredag 29 april 2016 kl. 20:45:47 UTC+2 skrev Angela Slaney:
I run sunriseset daily too. It works without problem for me.

I have the exact same issue on both my Galaxy s4 and Galaxy tab 4,  not a problem for me though since I can make it calculate the two values I need. 

Pent

unread,
Apr 30, 2016, 2:42:12 AM4/30/16
to Tasker

The task the APK starts with is called "Start Visible". The first action in this task is the Javascriptlet with the flash function. But I did not remove the other actions from this task or the other tasks from the project. If I should, just let me know. 

I had to remove them because of all the missing images otherwise. Perhaps that is why it worked for me. Could
you remove all but the first action and then test ?

The APK you supplied gives the error as you described.

The increased APK size compared to the last version is due to the updated Play Services client library and is
expected.

Pent

Zoltan Fazekas

unread,
Apr 30, 2016, 3:29:07 PM4/30/16
to Tasker
Now I removed all tasks but "Start_Visible" which the APK needs to start with. From this task I removed all actions except the Javascriptlet with the flash function. After exporting and reinstalling the APK I still get the Javascript error. I attached the new XML and APK again. 
dimory.prj.xml
dimory.375.apk

Zoltan Fazekas

unread,
Apr 30, 2016, 3:52:53 PM4/30/16
to Tasker
Pent, with which min. Android Version did you export the APK that worked for you? I exported it with API Level 19. Now I tested an APK exported with API Level 14 and it worked fine! So the Javascript problem seems to relate to the min. Android Version set when exporting APKs.

Zoltan


Am Samstag, 30. April 2016 08:42:12 UTC+2 schrieb Pent:

Pent

unread,
May 1, 2016, 3:08:47 AM5/1/16
to Tasker


Pent, with which min. Android Version did you export the APK that worked for you? I exported it with API Level 19. Now I tested an APK exported with API Level 14 and it worked fine! So the Javascript problem seems to relate to the min. Android Version set when exporting APKs.

I tested both my own and the simplified project you sent me with 19 without problem unfortunately. What's the largest API it still
works with ?

To summarize our two findings:

- works OK with new projects
- works OK with API 14

What if you delete then reimport the project ?

Pent
Message has been deleted

Pent

unread,
May 1, 2016, 3:28:40 AM5/1/16
to Tasker
OK, could reproduce it now.

Will investigate and get back to you.

Pent

Zoltan Fazekas

unread,
May 1, 2016, 4:08:35 AM5/1/16
to Tasker
The new project only worked because I exported the APK with min. Android Version 14. I deleted and reimported the old project again but the behaviour did not change. All APKs exported with min. Android Version 14 or 16 work fine, with min. Android Version 17 and above do not. I am using Tasker on an Android 4.4 device.

Zoltan

alex f

unread,
May 2, 2016, 1:50:36 PM5/2/16
to Tasker
On my side i have the same error than described on this post 

with a simplest script that flash a variable (tk.exit is not a function)
tested on android 5 and last version of app factory ./ tasker


Pent

unread,
May 3, 2016, 3:01:37 AM5/3/16
to Tasker
OK, found the problem there.

The fix that I had applied after the post alex f links to had been lost at some point.

Will try and get an update out in a few days (some other things to finish), sorry for
the trouble.

Pent

Zoltan Fazekas

unread,
May 3, 2016, 3:46:30 AM5/3/16
to Tasker
Great news, Pent!
Thank you

Zoltan

alex f

unread,
May 3, 2016, 4:33:19 AM5/3/16
to Tasker
Thanks Pent

alex f

unread,
May 6, 2016, 11:54:20 AM5/6/16
to Tasker
Works fine with last release, javascript works like a charm

Thanks again
Reply all
Reply to author
Forward
0 new messages