exception on js Android file, ONLY in distribution

You must Login before you can answer or comment on any questions.

Hello,

I have a weird issue that I face for the first time.

I have an app that works fine on developer mode. But after I create the distribution version, I get an exception on a file (which works fine on developer mode), I get the typical red screen error window indicating an exception. Upon creation of the distributed version, I do not get any errors or warnings on studio's console.

I know that when you distribute the app, titanium refactor the files for optimal performance. I tried to check the file generated in the build folder, but I cannot find anything wrong neither in the line indicated by the error window in the device (when I run the distributed version of the app from the device) or anywhere else in the file. I post below both my file and the generated one. Any ideas or help are more than welcome..

my file: http://pastie.org/4708597

the generated build file: http://pastie.org/4708604

— asked 10 months ago by Onoma Epitheto
10 Comments
  • What does the device error say?

    — commented 10 months ago by Shannon Hicks

  • One off-topic comment on your code...

    req.u.gs('OS') == 'android'

    When you use == javascript tries converting both sides to a common datatype. If you do === javascript will do a strict comparison, which is faster. So when you're comparing what you know are two strings, go ahead and use ===

    — commented 10 months ago by Shannon Hicks

  • What does the errormessage say to you?

    — commented 10 months ago by Esben Maaløe

  • Show 7 more comments

2 Answers

this is definitely a titanium bug.

Actually, no. Titanium has no way of knowing which .js file is to be used in app and which is to be used in a webview.

Your solution:

For now, I just rename the js file that is being wrongly interpreted by the bytecode compiler. I remove the js extension in order to remain as it is.

is the best way to work around this.

I have the same problem with a webview that worked fine in developer mode but in distribution javascript file that works with webview, doesnt. If i understood a possible solution is rename "problem js file"?

— answered 9 months ago by Mario Navarro Palos
answer permalink
1 Comment
  • the file that you would use in your webview, give it an alternative extenstion. The build scripts will only process the *.js files, leaving your file alone.

    — commented 9 months ago by Stephen Feather

Your Answer

Think you can help? Login to answer this question!