{ "id": "113615", "key": "AC-2611", "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": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2013-04-30T23:38:43.000+0000", "created": "2013-04-30T22:44:45.000+0000", "labels": [ "imageView", "media", "showcamera", "thumbnail" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:41:41.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": "This crashes on the Motorola Razr running Android 4.0.4, but runs OK on a Samsung Galaxy Y running Android 2.3.6 and on a Galaxy S3 running 4.1.2.\r\n\r\nThe code snippet is the following:\r\n\r\n{code}\r\niv = Ti.UI.createImageView();\r\n\r\n\r\nvar takePhoto = Ti.UI.createButton({\r\n title:\"Take Photo\",\r\n width: 129,\r\n height: 44,\r\n top: 80,\r\n left: 25,\r\n idx: i\r\n }, function(){\r\n Ti.Media.showCamera({\r\n \t\t\t\tallowEditing: false,\r\n \t\t\t\tmediaTypes: Ti.Media.MEDIA_TYPE_PHOTO,\r\n \t\t\t\tsaveToPhotoGallery: false,\r\n \t\t\t\tsuccess: function(e){\r\n\t\t\t\t\t\tiv.setImage(e.media.imageAsThumbnail(129, 0, 0));\r\n\t\t\t\t\t\t\r\n \t\t\t\t},\r\n\t\t\t\t\terror: function(e) {\r\n\t\t\t\t\t\talert(e);\r\n\t\t\t\t\t}\r\n \t\t\t});\r\n });\r\n{code}\r\n\r\n\r\nHere is the output on logcat monitor with the full crash path:\r\n\r\n{code}\r\n04-30 19:35:53.270: D/dalvikvm(13250): GC_FOR_ALLOC freed 542K, 25% free 15615K/20707K, paused 49ms\r\n04-30 19:35:53.270: I/dalvikvm-heap(13250): Forcing collection of SoftReferences for 31961104-byte allocation\r\n04-30 19:35:53.340: D/dalvikvm(13250): GC_BEFORE_OOM freed 0K, 25% free 15615K/20707K, paused 68ms\r\n04-30 19:35:53.340: E/dalvikvm-heap(13250): Out of memory on a 31961104-byte allocation.\r\n04-30 19:35:53.340: I/dalvikvm(13250): \"KrollRuntimeThread\" prio=5 tid=11 RUNNABLE\r\n04-30 19:35:53.340: I/dalvikvm(13250): | group=\"main\" sCount=0 dsCount=0 obj=0x41500870 self=0x21051f0\r\n04-30 19:35:53.340: I/dalvikvm(13250): | sysTid=13266 nice=0 sched=0/0 cgrp=default handle=34716648\r\n04-30 19:35:53.340: I/dalvikvm(13250): | schedstat=( 0 0 0 ) utm=298 stm=48 core=1\r\n04-30 19:35:53.340: I/dalvikvm(13250): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:530)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:586)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at org.appcelerator.titanium.TiBlob.getImage(TiBlob.java:492)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at org.appcelerator.titanium.TiBlob.imageAsThumbnail(TiBlob.java:540)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at org.appcelerator.kroll.runtime.v8.V8Function$1.run(V8Function.java:70)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at android.os.Handler.handleCallback(Handler.java:605)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at android.os.Handler.dispatchMessage(Handler.java:92)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at android.os.Looper.loop(Looper.java:137)\r\n04-30 19:35:53.340: I/dalvikvm(13250): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)\r\n04-30 19:35:53.340: D/skia(13250): --- decoder->decode returned false\r\n04-30 19:35:53.340: W/System.err(13250): java.lang.OutOfMemoryError\r\n04-30 19:35:53.348: W/System.err(13250): \tat android.graphics.BitmapFactory.nativeDecodeStream(Native Method)\r\n04-30 19:35:53.348: W/System.err(13250): \tat android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:530)\r\n04-30 19:35:53.348: W/System.err(13250): \tat android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:586)\r\n04-30 19:35:53.348: W/System.err(13250): \tat org.appcelerator.titanium.TiBlob.getImage(TiBlob.java:492)\r\n04-30 19:35:53.348: W/System.err(13250): \tat org.appcelerator.titanium.TiBlob.imageAsThumbnail(TiBlob.java:540)\r\n04-30 19:35:53.348: W/System.err(13250): \tat org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)\r\n04-30 19:35:53.348: W/System.err(13250): \tat org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)\r\n04-30 19:35:53.348: W/System.err(13250): \tat org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)\r\n04-30 19:35:53.348: W/System.err(13250): \tat org.appcelerator.kroll.runtime.v8.V8Function$1.run(V8Function.java:70)\r\n04-30 19:35:53.348: W/System.err(13250): \tat android.os.Handler.handleCallback(Handler.java:605)\r\n04-30 19:35:53.356: W/System.err(13250): \tat android.os.Handler.dispatchMessage(Handler.java:92)\r\n04-30 19:35:53.356: W/System.err(13250): \tat android.os.Looper.loop(Looper.java:137)\r\n04-30 19:35:53.356: W/System.err(13250): \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)\r\n04-30 19:35:53.512: E/TiExceptionHandler(13250): (main) [187280,278564] ----- Titanium Javascript Runtime Error -----\r\n04-30 19:35:53.512: E/TiExceptionHandler(13250): (main) [0,278564] - In form.js:408,49\r\n04-30 19:35:53.512: E/TiExceptionHandler(13250): (main) [0,278564] - Message: Uncaught Error: Java Exception occurred\r\n04-30 19:35:53.512: E/TiExceptionHandler(13250): (main) [0,278564] - Source: \t\t\t\t\t\tplaceholder[changeImage].setImage(e.media.imageAsThumbnail(129, 0, 0));\r\n04-30 19:35:53.535: E/V8Exception(13250): Exception occurred at form.js:408: Uncaught Error: Java Exception occurred\r\n{code}", "attachment": [], "flagged": false, "summary": "Trying to create an image from thumbnail on Android, crashes the app on some devices.", "creator": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "subtasks": [], "reporter": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "environment": "Android 4.0.2\r\nMotorola Razr\r\nTitanium 3.1.0.GA\r\n", "comment": { "comments": [ { "id": "249628", "author": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello Ygor,\nWhen submitting a bug report it is important that you provide a working test case that is able to be easily pasted into an app.js and when run, clearly shows the problem. This ensures a speedy review and thorough understanding of the problem on both sides. Would you mind editing the bug description to provide this test case? For future reference: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report\nRegards,\nCarter", "updateAuthor": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-30T23:38:29.000+0000", "updated": "2013-04-30T23:38:29.000+0000" }, { "id": "249940", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Hi Carter,\n\nI have asked one of our Android Engineers for elaborating the test case as he is with the device right now. I've just filled the bug report earlier as I had a stack trace and the bug is happening only on certain devices.\n\nDaniel will attach a test case soon.", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2013-05-02T17:21:37.000+0000", "updated": "2013-05-02T17:21:37.000+0000" }, { "id": "249963", "author": { "name": "panamadonne", "key": "panamadonne", "displayName": "Daniel Hansson", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Hi Carter,\nHere is a working test case with the problem.\n\n{noformat} \nvar w = Ti.UI.createWindow({\n\tbackgroundColor: \"#dddcdc\",\n navBarHidden: true,\n fullscreen: false,\n orientationModes: [Ti.UI.PORTRAIT]\n});\n\n\nvar rows = [];\n\n \n //PHOTOS\nvar photos = [],\nplaceholder = [],\nchangeImage = false;\n\nfor (var i=0, item; i<1; i++) { \n \n var r = Ti.UI.createTableViewRow({\n backgroundImage: \"img/form/photo.png\",\n height: 187,\n width: 320,\n className: \"rowPhoto\"\n });\n \n \n placeholder[i] = Ti.UI.createView({\n backgroundColor: \"#ccc\",\n width: 129,\n height: 95,\n top: 60,\n right: 25,\n\t\t\tzIndex: 5,\n\t\t\tautorotate: true,\n\t\t\tborderRadius:10\n });\n\n r.add(placeholder[i]);\n \n var takePhoto = Ti.UI.createButton({\n title: \"TAKE PHOTO\",\n width: 129,\n height: 129,\n top: 60,\n left: 25,\n idx: i\n });\n\n r.add(takePhoto);\n\n takePhoto.addEventListener(\"click\", function(e){\n changeImage = this.idx;\n \n\t\t\tTi.Media.showCamera({\n\t\t\t\tallowEditing: false,\n\t\t\t\tmediaTypes: Ti.Media.MEDIA_TYPE_PHOTO,\n\t\t\t\tsaveToPhotoGallery: false,\n\t\t\t\tsuccess: function(e){\n\t\t\t\t\tplaceholder[changeImage].setImage(e.media.imageAsThumbnail(129, 0, 0));\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\terror: function(e) {\n\t\t\t\t\talert(e);\n\t\t\t\t}\n\t\t\t});\n });\n \n rows.push(r);\n \n}\n \n\nvar t = Ti.UI.createTableView({\n backgroundColor: 'transparent',\n data: rows\n});\n \nw.add(t);\n\nw.open();\n{noformat}\n\n\nThanks in advance\nDaniel Hansson", "updateAuthor": { "name": "panamadonne", "key": "panamadonne", "displayName": "Daniel Hansson", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2013-05-02T18:46:06.000+0000", "updated": "2013-05-02T18:46:06.000+0000" }, { "id": "283536", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "We tried to reproduce this issue but were not able to reproduce with Titanium SDK 3.1.3GA. Please test your application with the sample code and let us know if the problem persists. \r\n\r\nh5. Testing Environment:\r\nTi CLI 3.3.0\r\nTitanium SDK: 3.1.3 and later \r\nAndroid SDK 2.3.3, 4.2.2\r\n\r\nh5. Test Code\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : '#000',\r\n\tlayout : 'vertical',\r\n\tnavBarHidden : false,\r\n\ttitle : 'Take a Photo From Camara'\r\n});\r\n\r\nvar takePhoto = Ti.UI.createButton({\r\n\ttitle : 'Take_Photo',\r\n\tcolor : '#000',\r\n\twidth : Ti.UI.SIZE,\r\n\theight : 60,\r\n\ttop : 10,\r\n});\r\n\r\nvar image = Ti.UI.createImageView({\r\n\ttop : 10,\r\n\theight : Ti.UI.SIZE,\r\n\twidth : Ti.UI.SIZE,\r\n});\r\n\r\nwin.add(takePhoto);\r\nwin.add(image); \r\ntakePhoto.addEventListener('click', function() {\r\n\r\n\tfireUpTheCamera();\r\n});\r\n\r\nfunction fireUpTheCamera() {\r\n\tTitanium.Media.showCamera({\r\n\r\n\t\tsuccess : function(event) {\r\n\t\t\tvar cropRect = event.cropRect;\r\n\t\t\tvar photo = event.media;\r\n\r\n\t\t\tTi.API.debug('Our type was: ' + event.mediaType);\r\n\t\t\tif (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\t\t\t\timage.setImage(photo.imageAsThumbnail(129, 0, 0));\r\n\r\n\t\t\t} else {\r\n\t\t\t\talert(\"got the wrong type back =\" + event.mediaType);\r\n\t\t\t}\r\n\t\t},\r\n\t\tcancel : function() {\r\n\t\t},\r\n\t\terror : function(error) {\r\n\t\t\talert('Unexpected error: ' + error.code);\r\n\t\t},\r\n\t\tsaveToPhotoGallery : false,\r\n\t\tallowEditing : false,\r\n\t\tmediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]\r\n\t});\r\n}\r\n\r\nwin.open();\r\n\r\n{code}", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-10T14:05:23.000+0000", "updated": "2013-12-17T21:25:57.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }