{ "id": "120621", "key": "AC-1890", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-10-22T17:48:31.000+0000", "created": "2013-09-30T14:23:03.000+0000", "labels": [ "3.1.2GA", "3.1.3", "Android", "IOS" ], "versions": [], "issuelinks": [], "assignee": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updated": "2016-03-08T07:40:48.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": "14544", "name": "Alloy", "description": "Please enter tickets related to the Alloy here." } ], "description": "This code\r\nvar barcode =Ti.UI.createWebView({\r\n top:\"30%\",\r\n left:\"33%\",\r\n height:\"25%\",\r\n width:\"37%\",\r\n url: \"/local/jscode39.html\"\r\n})\r\nbarcode.addEventListener('beforeload', function(e)\r\n{\r\n barcode.evalJS(\"var sku='\"+barcodesku+\"';\");\r\n});\r\n\r\nPresents the barcode in IOS just like it should but just produces a blank white slate on Android 4.0. \r\n\r\nIn the console it produces the following warnings and errors\r\n[WARN][webview ( 1051)] java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.\r\n[WARN][webview ( 1051)] at android.webkit.WebView.checkThread(WebView.java:9355)\r\n[WARN][webview ( 1051)] at android.webkit.WebView.getSettings(WebView.java:4053)\r\n[WARN][webview ( 1051)] at android.webkit.ZoomManager.getReadingLevelScale(ZoomManager.java:317)\r\n[WARN][webview ( 1051)] at android.webkit.WebView.getReadingLevelScale(WebView.java:2448)\r\n[WARN][webview ( 1051)] at android.webkit.WebViewCore.setupViewport(WebViewCore.java:2487)\r\n[WARN][webview ( 1051)] at android.webkit.WebViewCore.didFirstLayout(WebViewCore.java:2258)\r\n[WARN][webview ( 1051)] at android.webkit.WebViewCore.nativeUpdateFrameCache(Native Method)\r\n[WARN][webview ( 1051)] at android.webkit.WebViewCore.access$4900(WebViewCore.java:55)\r\n[WARN][webview ( 1051)] at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1458)\r\n[WARN][webview ( 1051)] at android.os.Handler.dispatchMessage(Handler.java:99)\r\n[WARN][webview ( 1051)] at android.os.Looper.loop(Looper.java:137)\r\n[WARN][webview ( 1051)] at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:722)\r\n[WARN][webview ( 1051)] at java.lang.Thread.run(Thread.java:856)\r\n\r\nThen I run it again and get thisDEBUG][Module ( 702)] Loading module: alloy/controllers/ticketview -> Resources/alloy/controllers/ticketview.js\r\n[DEBUG][TiAssetHelper( 702)] Fetching \"alloy/controllers/ticketview.js\" with Fastdev...\r\n[DEBUG][TiFastDev( 702)] (KrollRuntimeThread) [1572,7939] sent tokens successfully\r\n[DEBUG][TiFastDev( 702)] (KrollRuntimeThread) [6,7945] sent tokens successfully\r\n[DEBUG][dalvikvm( 702)] GC_CONCURRENT freed 385K, 4% free 12813K/13319K, paused 4ms+7ms\r\n[DEBUG][dalvikvm( 77)] GREF has increased to 401\r\n[WARN][webcore ( 702)] java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.\r\n[WARN][webcore ( 702)] \tat android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1671)\r\n[WARN][webcore ( 702)] \tat android.webkit.WebViewCore$EventHub.access$7800(WebViewCore.java:920)\r\n[WARN][webcore ( 702)] \tat android.webkit.WebViewCore.removeMessages(WebViewCore.java:1783)\r\n[WARN][webcore ( 702)] \tat android.webkit.WebView.sendOurVisibleRect(WebView.java:2858)\r\n[WARN][webcore ( 702)] \tat android.webkit.ZoomManager.setZoomScale(ZoomManager.java:586)\r\n[WARN][webcore ( 702)] \tat android.webkit.ZoomManager.access$1700(ZoomManager.java:49)\r\n[WARN][webcore ( 702)] \tat android.webkit.ZoomManager$PostScale.run(ZoomManager.java:977)\r\n[WARN][webcore ( 702)] \tat android.os.Handler.handleCallback(Handler.java:605)\r\n[WARN][webcore ( 702)] \tat android.os.Handler.dispatchMessage(Handler.java:92)\r\n[WARN][webcore ( 702)] \tat android.os.Looper.loop(Looper.java:137)\r\n[WARN][webcore ( 702)] \tat android.app.ActivityThread.main(ActivityThread.java:4340)\r\n[WARN][webcore ( 702)] \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[WARN][webcore ( 702)] \tat java.lang.reflect.Method.invoke(Method.java:511)\r\n[WARN][webcore ( 702)] \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)\r\n[WARN][webcore ( 702)] \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)\r\n[WARN][webcore ( 702)] \tat dalvik.system.NativeStart.main(Native Method)\r\n[INFO][TiAPI ( 702)] sku = 223456789\r\n[WARN][webview ( 702)] java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.\r\n[WARN][webview ( 702)] \tat android.webkit.WebView.checkThread(WebView.java:9355)\r\n[WARN][webview ( 702)] \tat android.webkit.WebView.getSettings(WebView.java:4053)\r\n[WARN][webview ( 702)] \tat android.webkit.ZoomManager.getReadingLevelScale(ZoomManager.java:317)\r\n[WARN][webview ( 702)] \tat android.webkit.WebView.getReadingLevelScale(WebView.java:2448)\r\n[WARN][webview ( 702)] \tat android.webkit.WebViewCore.setupViewport(WebViewCore.java:2487)\r\n[WARN][webview ( 702)] \tat android.webkit.WebViewCore.didFirstLayout(WebViewCore.java:2258)\r\n[WARN][webview ( 702)] \tat android.webkit.WebViewCore.nativeUpdateFrameCache(Native Method)\r\n[WARN][webview ( 702)] \tat android.webkit.WebViewCore.access$4900(WebViewCore.java:55)\r\n[WARN][webview ( 702)] \tat android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1458)\r\n[WARN][webview ( 702)] \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\n[WARN][webview ( 702)] \tat android.os.Looper.loop(Looper.java:137)\r\n[WARN][webview ( 702)] \tat android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:722)\r\n[WARN][webview ( 702)] \tat java.lang.Thread.run(Thread.java:856)\r\n[INFO][TiWebChromeClient.console( 702)] (main) [2532,10477] Uncaught SyntaxError: Unexpected token var (1:file:///android_asset/Resources/local/jscode39.html)\r\n[WARN][TiWebViewBinding( 702)] (KrollRuntimeThread) [2293,12770] Timeout waiting to evaluate JS\r\n[INFO][WindowManager( 77)] createSurface Window{41603098 Panel:com.cstg.ticket1/com.cstg.ticket1.Ticket1aActivity paused=false}: DRAW NOW PENDING\r\n[DEBUG][dalvikvm( 702)] GC_CONCURRENT freed 394K, 4% free 13294K/13831K, paused 4ms+10ms\r\n\r\n\r\nI can see the SKU variable has something in it (through TI.API.info commands and in the console) but apparently its not getting to the JS file in the local directory. \r\n\r\nThe file structure is \r\nAPP \r\nResources\r\nlocal\r\nthen the HTML / JS and the gif images to load the barcode white and black bars\r\n\r\non IOS it works like a champ (both in the simulator and a device) but not android either in the emulator or on a device\r\n\r\nThanks\r\nJohn\r\n\r\n\r\n", "attachment": [], "flagged": false, "summary": "Local HTML / JS working on IOS not Android", "creator": { "name": "jfschimanskijr@gmail.com", "key": "jfschimanskijr@gmail.com", "displayName": "John Schimanski", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jfschimanskijr@gmail.com", "key": "jfschimanskijr@gmail.com", "displayName": "John Schimanski", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Win 7 Pro / TI 3.1.3GA Android 4.0 / Mac OSX TI 3.1.2GA Android 4.0 IOS 7.", "comment": { "comments": [ { "id": "273971", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hi John Schimanski,\r\n\r\nCould you share your js or HTML file so that i can reproduce this issue. I have tested html file titanium 3.1.3 android 4.0 but it works.\r\nThanks", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2013-10-07T04:16:26.000+0000", "updated": "2013-10-07T05:27:56.000+0000" }, { "id": "274003", "author": { "name": "jfschimanskijr@gmail.com", "key": "jfschimanskijr@gmail.com", "displayName": "John Schimanski", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Motiur,\n\nDo you want me to upload the files ? I am new to the JIRA system so I am not sure how you wish me to share the files. \n \nplease let me know.\n\njohn\n", "updateAuthor": { "name": "jfschimanskijr@gmail.com", "key": "jfschimanskijr@gmail.com", "displayName": "John Schimanski", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-07T15:28:10.000+0000", "updated": "2013-10-07T15:28:10.000+0000" }, { "id": "274006", "author": { "name": "jfschimanskijr@gmail.com", "key": "jfschimanskijr@gmail.com", "displayName": "John Schimanski", "active": true, "timeZone": "America/Los_Angeles" }, "body": "here is the JS code from titanium\n\nvar barcodesku = \"1234567890\";\n\nvar barcode =Ti.UI.createWebView({\n\ttop:\"30%\",\n\tleft:\"33%\",\n\theight:\"25%\",\n\twidth:\"100%\",\n\tbackgroundColor: \"red\",\n\turl: \"/local/jscode39.html\"\n})\nbarcode.addEventListener('beforeload', function(e)\n{\n\tbarcode.evalJS(\"var sku='\"+barcodesku+\"';\");\n});\n$.index.add(barcode);\n\n\n$.index.open();\n\t\n\n\n\n\nhere is the file that it is calling from the url line. named jscode39.html\n\n\n\n\n\n\n\n\n\n\n\nand this is the actual JS file that the html file calls . it is names code39.jslocal\n\n// JavaScript BarCode39 v. 1.0 (c) Lutz Tautenhahn, 2005\n// The author grants you a non-exclusive, royalty free, license to use,\n// modify and redistribute this software.\n// This software is provided \"as is\", without a warranty of any kind.\n\nChars=\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%\";\nCodes=new Array(\n\"111221211\",\"211211112\",\"112211112\",\"212211111\",\"111221112\",\"211221111\",\"112221111\",\"111211212\",\n\"211211211\",\"112211211\",\"211112112\",\"112112112\",\"212112111\",\"111122112\",\"211122111\",\"112122111\",\n\"111112212\",\"211112211\",\"112112211\",\"111122211\",\"211111122\",\"112111122\",\"212111121\",\"111121122\",\n\"211121121\",\"112121121\",\"111111222\",\"211111221\",\"112111221\",\"111121221\",\"221111112\",\"122111112\",\n\"222111111\",\"121121112\",\"221121111\",\"122121111\",\"121111212\",\"221111211\",\"122111211\",\"121121211\",\n\"121212111\",\"121211121\",\"121112121\",\"111212121\");\nBarPic=new Array(2);\nBarPic[0]=new Image(); BarPic[0].src=\"b.gif\"\nBarPic[1]=new Image(); BarPic[1].src=\"w.gif\"\n\nfunction Code39(theX, theY, theBarHeight, theFontHeight, theBarCodeText, theBarCodeSize)\n{ var pp=\"\", ff, ss=1;\n if (theBarCodeSize) ss=parseInt(theBarCodeSize);\n if (isNaN(ss)) ss=1;\n if (ss<1) ss=1;\n if ((theX!=\"\")&&(theY!=\"\")) pp=\"position:absolute;left:\"+theX+\";top:\"+theY+\";\";\n if ((theFontHeight>4)&&(theBarHeight>=2*theFontHeight))\n { ff=\"style='font-size:\"+theFontHeight+\"px;font-family:Verdana;'\";\n document.write(\"
\");\n document.write(\"\");\n for (i=0; i\"+CodePics(theBarCodeText.charAt(i),theBarHeight-theFontHeight-1, ss)+\"\");\n document.write(\"\");\n document.write(\"\");\n for (i=0; i\"+theBarCodeText.charAt(i)+\"\");\n document.write(\"
\"+CodePics(\"*\",theBarHeight, ss)+\"\"+CodePics(\"*\",theBarHeight, ss)+\"
\");\n }\n else\n { document.write(\"
\");\n document.write(\"\");\n for (i=0; i\"+CodePics(theBarCodeText.charAt(i),theBarHeight, ss)+\"\");\n document.write(\"
\"+CodePics(\"*\",theBarHeight, ss)+\"\"+CodePics(\"*\",theBarHeight, ss)+\"
\");\n }\n}\nfunction CodePics(theChar, theHeight, theSize)\n{ var ss=\"\", cc=\"9\", ii=Chars.indexOf(theChar);\n if (ii>=0) cc=Codes[ii];\n for (ii=0; ii\";\n ss+=\"\";\n return(ss);\n}\n\nit has two GIF files that it calls for the black and white bars on the screen. When I run it in IOS it runs just fine and I can see the barcode. When I run it on Android 4.0.2 i get the webview core error messages and all I see i the background color (red).\n\nI got the barcode images from http://barcode-coder.com/en/barcode-jquery-plugin-201.html\n\nany idea what i am doing wrong?\n\nJohn\n", "updateAuthor": { "name": "jfschimanskijr@gmail.com", "key": "jfschimanskijr@gmail.com", "displayName": "John Schimanski", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-07T15:57:04.000+0000", "updated": "2013-10-07T15:57:04.000+0000" }, { "id": "276181", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Hello,\r\ncan you please check this?\r\n\r\nhttp://stackoverflow.com/questions/8413912/in-appcelerator-titanium-mobile-when-using-local-html-in-a-webview-how-do-i-lo\r\n\r\nthe Web prefix is not the same in iOS and Android, that's the reason it fails in android and work in iOS.\r\n\r\nBest,\r\n\r\nMauro", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2013-10-22T17:48:31.000+0000", "updated": "2013-10-22T17:48:31.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }