{ "id": "151688", "key": "TIMOB-19910", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-04-14T20:52:58.000+0000", "created": "2015-10-02T14:33:35.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "Community" ], "versions": [ { "id": "16904", "description": "Release 5.0.2", "name": "Release 5.0.2", "archived": true, "released": true, "releaseDate": "2015-10-01" } ], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-12-20T03:40:53.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": "10202", "name": "Android", "description": "Android Platform" } ], "attachment": [], "flagged": false, "summary": "Android: openPhotoGallery fails when remote image selected", "creator": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 618, "state": "closed", "name": "2016 Sprint 08 SDK", "startDate": "2016-04-09T00:30:18.262Z", "endDate": "2016-04-23T00:30:00.000Z", "completeDate": "2016-04-25T02:38:28.511Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "365728", "author": { "name": "ahossain", "key": "ahossain", "displayName": "Amimul Hossain", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~manuellehner], I have tested this issue with SDK 5.0.0.GA, 5.0.1.GA. The issue is seems to be resolved.\r\n\r\nEnvironment\r\n\r\nTI SDK 5.0.0.GA, 5.0.1.GA CLI 5.0.2\r\nAndroid 5.0.2, Galaxy A5.\r\n\r\nBelow is the output log when a particular image is opened and selected from \"gallery\".\r\n\r\n{code}\r\n[INFO] : event.media.nativePath: file:///storage/emulated/0/DCIM/Camera/20150930_223405.jpg\r\n[INFO] : event.media.file.nativePath: content://media/external/images/media/38175\r\n{code}\r\nAnd, Here is the output log when that particular image is opened and selected from \"google photos\".\r\n{code}\r\n[INFO] : event.media.nativePath: file:///storage/emulated/0/DCIM/Camera/20150930_223405.jpg\r\n[INFO] : event.media.file.nativePath: content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F38175/ACTUAL/1431804670\r\n{code}\r\nBoth are performed simultaneously one after another. No Java exception occurred. Thanks.\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n\r\n\tbackgroundColor : '#fff',\r\n\r\n\tlayout : 'vertical'\r\n\r\n});\r\n\r\n \r\n\r\nvar camera = Ti.UI.createButton({\r\n\r\n\tbackgroundColor : '#ff0000',\r\n\r\n\ttitle : 'Open Gallery',\r\n\r\n\tcolor : '#fff',\r\n\r\n\twidth : Ti.UI.SIZE,\r\n\r\n\theight : Ti.UI.SIZE,\r\n\r\n\ttop : 30\r\n\r\n \r\n\r\n});\r\n\r\n \r\n\r\ncamera.addEventListener('click', function() {\r\n\r\n\topenGallery();\r\n\r\n\t//rear();\r\n\r\n});\r\n\r\n \r\n\r\n// Create an ImageView.\r\n\r\nvar addPreviewImage = Ti.UI.createImageView({\r\n\r\n\timage : 'location',\r\n\r\n\twidth : 200,\r\n\r\n\theight : 200,\r\n\r\n\ttop : 20,\r\n\r\n});\r\n\r\n \r\n\r\n// Add to the parent view.\r\n\r\nwin.add(camera);\r\n\r\nwin.add(addPreviewImage);\r\n\r\n \r\n\r\nfunction openGallery() {\r\n\r\n\tTitanium.Media.openPhotoGallery({\r\n\r\n\t\tsuccess : function(event) {\r\n\r\n\t\t\tif (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {\r\n\r\n\t\t\t\taddPreviewImage.setImage(event.media);\r\n\r\n\t\t\t\ttry {\r\n\r\n\t\t\t\t\tTi.API.info('event.media.nativePath: ' + event.media.nativePath);\r\n\r\n\t\t\t\t} catch(e) {\r\n\r\n\t\t\t\t\tTi.API.error(e.message);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tTi.API.info('event.media.file.nativePath: ' + event.media.file.nativePath);\r\n\r\n \r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t//alert(\"got the wrong type back =\" + event.mediaType);\r\n\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\tcancel : function() {\r\n\r\n\t\t\t// called when user cancels taking a picture\r\n\r\n\t\t},\r\n\r\n\t\terror : function(error) {\r\n\r\n\t\t\t// called when there's an error\r\n\r\n\t\t\tvar a = Titanium.UI.createAlertDialog({\r\n\r\n\t\t\t\ttitle : 'Camera'\r\n\r\n\t\t\t});\r\n\r\n\t\t\tif (error.code == Titanium.Media.NO_CAMERA) {\r\n\r\n\t\t\t\ta.setMessage('Please run this test on device');\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ta.setMessage('Unexpected error: ' + error.code);\r\n\r\n\t\t\t}\r\n\r\n\t\t\ta.show();\r\n\r\n\t\t},\r\n\r\n\t\tallowEditing : true,\r\n\r\n\t\tmediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]\r\n\r\n\t});\r\n\r\n}\r\n\r\n \r\n\r\nwin.open();\r\n{code}\r\n\r\nThanks.", "updateAuthor": { "name": "ahossain", "key": "ahossain", "displayName": "Amimul Hossain", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2015-10-04T05:41:56.000+0000", "updated": "2015-10-04T05:41:56.000+0000" }, { "id": "365774", "author": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~ahossain] Thanks for testing. I've just tested this again with your example code with 4.1.0.GA and 5.0.0.GA - but I was able to reproduce this error (testing on a Nexus 5).\r\n\r\nI've selected two images from Google Photos, first one stored on the device, works fine:\r\n{code}\r\n[INFO] : event.media.nativePath: file:///storage/emulated/0/DCIM/Camera/IMG_20151002_095208.jpg\r\n[INFO] : event.media.file.nativePath: content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F105558/ACTUAL/688518979\r\n{code}\r\n\r\nThe second image is not on the device, it loads the file from the cloud and then shows this log:\r\n{code}\r\n[WARN] : W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference\r\n[WARN] : W/System.err: \tat java.io.File.fixSlashes(File.java:185)\r\n[WARN] : W/System.err: \tat java.io.File.(File.java:134)\r\n[WARN] : W/System.err: \tat org.appcelerator.titanium.io.TitaniumBlob.getNativeFile(TitaniumBlob.java:97)\r\n[WARN] : W/System.err: \tat org.appcelerator.titanium.TiBlob.getNativePath(TiBlob.java:529)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function$1.run(V8Function.java:70)\r\n[WARN] : W/System.err: \tat android.os.Handler.handleCallback(Handler.java:739)\r\n[WARN] : W/System.err: \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n[WARN] : W/System.err: \tat android.os.Looper.loop(Looper.java:135)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)\r\n[ERROR] : Attempt to invoke virtual method 'char[] java.lang.String.toCharArray()' on a null object reference\r\n[INFO] : event.media.file.nativePath: content://com.google.android.apps.photos.contentprovider/0/1/mediaKey%3A%2FAF1QipPIihdsteNy0HTCR2MVdCdbjTTNvt10V_lMHKJL/ACTUAL/404242549\r\n{code}\r\n\r\nAlthough it shows the image in the preview, I'm not able to upload the Blob to my server which works fine for locally stored images. ", "updateAuthor": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-10-05T09:00:17.000+0000", "updated": "2015-10-05T09:00:17.000+0000" }, { "id": "369382", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~manuellehner], I have observed the similar issue with SDK 5.0.2.GA. In Android 4.4.2 Device, when a photo is selected from Google Photos and if the photo is not existing in device the image first downloads and loads into the image view. In addition to that the following error occur.\r\n\r\n{code}\r\n[WARN] : W/System.err: java.lang.NullPointerException\r\n[WARN] : W/System.err: \tat java.io.File.fixSlashes(File.java:185)\r\n[WARN] : W/System.err: \tat java.io.File.(File.java:134)\r\n[WARN] : W/System.err: \tat org.appcelerator.titanium.io.TitaniumBlob.getNativeFile(TitaniumBlob.java:97)\r\n[WARN] : W/System.err: \tat org.appcelerator.titanium.TiBlob.getNativePath(TiBlob.java:529)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:57)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:43)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.runtime.v8.V8Function$1.run(V8Function.java:70)\r\n[WARN] : W/System.err: \tat android.os.Handler.handleCallback(Handler.java:808)\r\n[WARN] : W/System.err: \tat android.os.Handler.dispatchMessage(Handler.java:103)\r\n[WARN] : W/System.err: \tat android.os.Looper.loop(Looper.java:193)\r\n[WARN] : W/System.err: \tat org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)\r\n[ERROR] : Java Exception occurred\r\n[INFO] : event.media.file.nativePath: content://com.google.android.apps.photos.contentprovider/0/1/mediaKey%3A%2FAF1QipMz-KZetA16ZU5d4QOrSTvC0tOyhrEP5NeVnQqN/ACTUAL/1594537096\r\n{code}\r\n\r\nThanks. ", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-09T09:29:57.000+0000", "updated": "2015-11-11T02:49:56.000+0000" }, { "id": "372252", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~manuellehner] Which Android version were you using? Was it Android 6.0?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-12-07T03:24:11.000+0000", "updated": "2015-12-07T03:24:11.000+0000" }, { "id": "372275", "author": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "body": "Yes, Android 6.0, but I remember having the same problem with Android 5.x\r\n", "updateAuthor": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-12-07T08:43:44.000+0000", "updated": "2015-12-07T08:43:44.000+0000" }, { "id": "377903", "author": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi,\r\n\r\nI'm having the same problem.\r\nI found out that this is a problem with native code as well.\r\nSee this: http://stackoverflow.com/questions/24573640/android-error-upload-image-in-different-android-versions\r\nI've confirmed that this is an issue with the photos app, when selecting media that is available on the cloud.\r\nIs it possible to work around the issue using the DocumentsProvider API as stated in the answer from the link?", "updateAuthor": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-25T18:09:21.000+0000", "updated": "2016-02-25T18:09:21.000+0000" }, { "id": "381271", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~filaruina] I see. Thank you for that link. Are you using that natively (DocumentsProvider)?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-04-01T06:17:43.000+0000", "updated": "2016-04-01T06:17:43.000+0000" }, { "id": "381306", "author": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "body": "No, I just limited this functionality on my app, which is terrible, but while appcelerator doesn't give us a solution, I'll have to live with that.", "updateAuthor": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-04-01T17:04:48.000+0000", "updated": "2016-04-01T17:04:48.000+0000" }, { "id": "381426", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/7911", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-04-04T08:01:51.000+0000", "updated": "2016-04-04T08:01:51.000+0000" }, { "id": "382776", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR merged.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-04-15T01:35:10.000+0000", "updated": "2016-04-15T01:35:10.000+0000" }, { "id": "382827", "author": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks! Will wait for the update and try it.", "updateAuthor": { "name": "filipe.laruina", "key": "filipe.laruina", "displayName": "Filipe La Ruina", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-04-15T14:07:37.000+0000", "updated": "2016-04-15T14:07:37.000+0000" }, { "id": "389196", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\n\r\n{{openPhotoGallery}} does not fail when remote image is selected.\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.7.0.201606150733\r\nTi SDK : 5.4.0.v20160617074028\r\nTi CLI : 5.0.9\r\nAlloy : 1.9.0\r\nMAC El Capitan : 10.11.4\r\nAppc NPM : 4.2.7-2\r\nAppc CLI : 5.4.0-18\r\nNode: 4.4.4\r\nNexus 6 - Android 6.0.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-28T01:02:04.000+0000", "updated": "2016-06-28T01:02:04.000+0000" }, { "id": "403408", "author": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Is anyone else getting this error when using openPhotoGallery with SDK 6.0.0? I started getting it all of a sudden and gallery image selection became completely broken.", "updateAuthor": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-15T07:03:03.000+0000", "updated": "2016-12-15T07:03:03.000+0000" }, { "id": "403654", "author": { "name": "rkhanna", "key": "rkhanna", "displayName": "Rohit Khanna", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Hello, Even i got this error yesterday working on SDK 6.0.0. If I assign the \"e.media\" to my imageView.image property is does display the image but as soon as I try and explore the \"e.media\", either to extract e.media.nativePath or even JSON.Stringify(e.media), it gives me this error.\r\n\r\nAny guidance , highly appreciated.\r\n\r\nCheers", "updateAuthor": { "name": "rkhanna", "key": "rkhanna", "displayName": "Rohit Khanna", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2016-12-20T03:08:13.000+0000", "updated": "2016-12-20T03:08:13.000+0000" }, { "id": "403656", "author": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "dfoxinator", "key": "dfoxinator", "displayName": "David Fox", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-20T03:36:30.000+0000", "updated": "2016-12-20T03:36:30.000+0000" }, { "id": "403657", "author": { "name": "rkhanna", "key": "rkhanna", "displayName": "Rohit Khanna", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Thanks David, :) I will follow the progress there.. Cheers", "updateAuthor": { "name": "rkhanna", "key": "rkhanna", "displayName": "Rohit Khanna", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2016-12-20T03:40:53.000+0000", "updated": "2016-12-20T03:40:53.000+0000" } ], "maxResults": 21, "total": 21, "startAt": 0 } } }