{ "id": "171986", "key": "TIMOB-26248", "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": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-05-01T20:36:41.000+0000", "created": "2018-07-31T11:14:06.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "engReviewed", "hyperloop" ], "versions": [], "issuelinks": [ { "id": "57791", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "173957", "key": "TIMOB-27298", "fields": { "summary": "Android: Hyperloop should allow access to a Java inner class within an inner class", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-05-01T20:36: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": "13715", "name": "Hyperloop", "description": "Hyperloop project" } ], "description": "If I create a new project and add {code}var mediastore = require('android.provider.MediaStore.Images.Media');{code} I get the following error.\r\n{code}\r\nRequested module not found: android.provider.MediaStore.Images.Media\r\n{code}\r\n\r\nTrace level logs are attached\r\n\r\n", "attachment": [ { "id": "65403", "filename": "Android MediaStore.Images.Media logs", "author": { "name": "donald.anderson", "key": "donald.anderson", "displayName": "Donald Anderson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-31T11:13:35.000+0000", "size": 362871, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "Hyperloop: Android - Cannot use android.provider.MediaStore.Images.Media API", "creator": { "name": "donald.anderson", "key": "donald.anderson", "displayName": "Donald Anderson", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "donald.anderson", "key": "donald.anderson", "displayName": "Donald Anderson", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "439627", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "What if you only require {{android.provider.MediaStore}} and access {{Images.Media}} from the result? e.g.\r\n{code:js}\r\nvar MediaStore = require('android.provider.MediaStore');\r\nvar DATE_ADDED = MediaStore.Images.Media.DATE_ADDED;\r\n{code}\r\nLooking [here|https://stackoverflow.com/questions/23343783/how-can-i-fix-errors-about-imports-in-this-code], someone tried your import natively and it did not work either, so you may need to import it like above. It may be because of it's static context, but thats just troubleshooting. In other examples like [here|https://stackoverflow.com/questions/13772138/android-read-any-specific-image-from-sd-card-and-display-it-as-bitmap], it's always {{MediaStore}} being required, it's sub-constants are accessed via it then.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-31T13:14:36.000+0000", "updated": "2018-07-31T13:15:29.000+0000" }, { "id": "439628", "author": { "name": "donald.anderson", "key": "donald.anderson", "displayName": "Donald Anderson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I can't seem to get at the media sub-class. if I use this.\r\n{code}\r\nvar mediastore = require('android.provider.MediaStore');\r\nconsole.log(\"1:\", mediastore.Images);\r\nconsole.log(\"2:\", mediastore.Images.Media);\r\n{code}\r\nit prints the following\r\n{code}\r\n[INFO] : 1: function () {\r\n[INFO] : var result;\r\n[INFO] : // Allow the constructor to either invoke the real java constructor, or function as a \"wrapping\" method that will take\r\n[INFO] : // a single argument that is a native hyperloop proxy for this class type and just wraps it in our JS type.\r\n[INFO] : if (arguments.length == 1 && arguments[0].isNativeProxy && arguments[0].isInstanceProxy && arguments[0].isInstanceOf('android.provider.MediaStore$Images')) {\r\n[INFO] : result = arguments[0];\r\n[INFO] : }\r\n[INFO] : else {\r\n[INFO] : result = Images.class.newInstance(arguments);\r\n[INFO] : }\r\n[INFO] : \r\n[INFO] : this.$native = result;\r\n[INFO] : this._hasPointer = result != null;\r\n[INFO] : this._private = {};\r\n[INFO] : }\r\n[INFO] : 2: undefined\r\n{code}\r\nIf I use this\r\n{code}\r\nvar Images = require('android.provider.MediaStore.Images');\r\nconsole.log(\"1:\", Images);\r\nconsole.log(\"2:\", Images.Media);\r\n{code}\r\nIt prints this.\r\n{code}\r\n[INFO] : 1: function () {\r\n[INFO] : var result;\r\n[INFO] : // Allow the constructor to either invoke the real java constructor, or function as a \"wrapping\" method that will take\r\n[INFO] : // a single argument that is a native hyperloop proxy for this class type and just wraps it in our JS type.\r\n[INFO] : if (arguments.length == 1 && arguments[0].isNativeProxy && arguments[0].isInstanceProxy && arguments[0].isInstanceOf('android.provider.MediaStore$Images')) {\r\n[INFO] : result = arguments[0];\r\n[INFO] : }\r\n[INFO] : else {\r\n[INFO] : result = Images.class.newInstance(arguments);\r\n[INFO] : }\r\n[INFO] : \r\n[INFO] : this.$native = result;\r\n[INFO] : this._hasPointer = result != null;\r\n[INFO] : this._private = {};\r\n[INFO] : }\r\n[INFO] : 2: undefined\r\n{code}\r\nIt doesn't seem to matter if I try to import the class directly or access it though it's parents, it doesn't seem to exist.\r\n", "updateAuthor": { "name": "donald.anderson", "key": "donald.anderson", "displayName": "Donald Anderson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-31T13:34:27.000+0000", "updated": "2018-07-31T13:34:27.000+0000" }, { "id": "439629", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Then it might indeed be a bug. [~jquick] [~gmathews] do you know more?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-31T14:39:47.000+0000", "updated": "2018-07-31T14:39:47.000+0000" }, { "id": "439632", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This appears to be a Hyperloop limitation.\r\n\r\nThe {{Media}} class within {{android.provider.MediaStore$Images$Media}} is an inner class within another {{Images}} inner class. Hyperloop can access the 1st inner class, but not an inner class within another inner class. I can successfully require it in Hyperloop using the dollar sign {{'$'}} version above, but Hyperloop will fail to provide the static constants/methods. So, it doesn't solve anything.\r\n\r\nYou can work-around this issue for now by using Google's {{ContentResolver}} class instead, which is what the {{Media}} class uses internally. Have a look at Google's code here...\r\n[MediaStore.java#L861|https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/provider/MediaStore.java#L861]\r\n\r\nAnd their {{ContentResolver}} class documentation can be found here...\r\nhttps://developer.android.com/reference/android/content/ContentResolver\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-31T19:51:43.000+0000", "updated": "2018-07-31T19:51:43.000+0000" }, { "id": "455327", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This was resolved as of Titanium 9.0.0 via ticket [TIMOB-27298].", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-05-01T20:36:15.000+0000", "updated": "2020-05-01T20:36:15.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }