{ "id": "100916", "key": "AC-2361", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2013-04-02T19:01:53.000+0000", "created": "2012-09-12T09:37:15.000+0000", "labels": [ "triage" ], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2017-10-22T15:49:31.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "When developing, eval recognizes properly functions and variables declared in its same namespace, both on emulator and on device (I tried on different devices with Android 2.3.3, 3.2 and 4.0, and it always worked installing from Titanium Studio).\r\nWhen compiling for distribution and installing on a device it gives a Runtime Error that reports a variable (involved in an eval function... but this is not specified in the error) is undefined.\r\n\r\nFollows a trivial example:\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : \"#FFF\"\r\n});\r\n\r\nvar func_a = function(p) {\r\n\treturn ++p;\r\n}\r\nvar func_b = function(p) {\r\n\treturn --p;\r\n}\r\nvar param = 10;\r\nif (param > 5) {\r\n\tvar f = \"b\";\r\n} else {\r\n\tvar f = \"a\";\r\n}\r\n\r\nvar result = eval(\"func_\" + f + \"(param)\");\r\n\r\nalert(f + \": \" + result);\r\n\r\nwin.open();\r\n{code}\r\n\r\n\r\nThis would work correctly when running on the emulator or on a device installing from Titanium Studio, but would give the following error when using the app after compiling for distribution:\r\n\r\n*_Runtime Error_*\r\n*Location:*\r\n[1,1] undefined\r\n*Message:*\r\nUncaught ReferenceError: func_b is not defined\r\n*Source:*\r\nfunc_b(param)", "attachment": [], "flagged": false, "summary": "Android: eval doesn't reference properly to functions and variables when compiling for distribution", "creator": { "name": "claudio.caronia", "key": "claudio.caronia", "displayName": "Claudio Caronia", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "claudio.caronia", "key": "claudio.caronia", "displayName": "Claudio Caronia", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OSx 10.7.4, Titanium Studio 2.1.2.201208301612, Intel Core i7", "comment": { "comments": [ { "id": "245225", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Cannot reproduce with Ti SDK 3.0.2 GA with Samsung Galaxy S2 Android 2.3.6.\r\n\r\nI installed to the device through studio in development mode, worked fine. I uninstalled the app. I then packaged the app for distribution, installed with \"adb install\", ran it, and it still worked fine.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-02T19:01:53.000+0000", "updated": "2013-04-02T19:01:53.000+0000" }, { "id": "429393", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-22T15:49:31.000+0000", "updated": "2017-10-22T15:49:31.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }