{ "id": "171973", "key": "TIMOB-26240", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-07-31T17:07:41.000+0000", "created": "2018-07-27T02:11:09.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "log" ], "versions": [ { "id": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "issuelinks": [ { "id": "56699", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "171953", "key": "TIMOB-26228", "fields": { "summary": "Android: Cannot get current activity in native module when using 7.3.0+", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-03T18:27:52.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" } ], "description": "*Summary:*\r\nA Titanium 7.3.0 built Android app will log the following messages on startup.\r\n\r\n{code}\r\n[ERROR] : TiApplication: (main) [806,864] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [3,867] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [25,892] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [13,905] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [4,909] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [1,910] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [3,913] No valid root or current activity found for application instance\r\n[WARN] : TiAndroid: (main) [2,915] Application instance no longer available. Unable to get current activity.\r\n[ERROR] : TiApplication: (main) [1,916] No valid root or current activity found for application instance\r\n[WARN] : TiAndroid: (main) [1,917] Application instance no longer available. Unable to get current activity.\r\n[WARN] : TiAndroid: (main) [0,917] Application instance no longer available. Unable to get current activity.\r\n[ERROR] : TiApplication: (main) [2,919] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [6,925] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [1,926] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [2,928] No valid root or current activity found for application instance\r\n[ERROR] : TiApplication: (main) [2,930] No valid root or current activity found for application instance\r\n{code}\r\n\r\nThese errors/warnings are actually harmless noise triggered by Titanium when loading its core modules (ie: {{Ti}}, {{Ti.UI}}, {{Ti.Platform}}, etc.) when the Android {{Application}} instance gets created, but before an {{Activity}} has been created. There is no {{Activity}} to fetch at this point in the code and the modules already correctly handle {{null}} and will fetch a valid {{Activity}} later when needed.\r\n\r\n*Recommended Solution:*\r\nIt's the responsibility of the caller to handle the null case, not the method.\r\n\r\nSo, remove the {{\"Application instance no longer available.\"}} log message in {{AndroidModule.getCurrentActivity()}} here...\r\nhttps://github.com/appcelerator/titanium_mobile/blob/7_3_X/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java#L580\r\n\r\nAnd remove the {{\"No valid root or current activity found for application instance\"}} log message from {{TiApplication.getRootOrCurrentActivity()}} here...\r\nhttps://github.com/appcelerator/titanium_mobile/blob/7_3_X/android/titanium/src/java/org/appcelerator/titanium/TiApplication.java#L297\r\n\r\n*Side Note:*\r\nThe {{TiApplication.getInstance()}} call can never return {{null}}. The Android {{Application}} class is always the 1st object to be created within the app and is guaranteed to exist for the lifetime of the app. There is no point in doing a {{null}} check on it. Nor do we need to keep a weak reference to it within {{TiApplication}}. A normal strong reference will suffice.\r\n", "attachment": [], "flagged": false, "summary": "Android: Remove harmless activity errors/warnings logged on startup", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "439612", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10219\r\nPR (7.3.X): https://github.com/appcelerator/titanium_mobile/pull/10220\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-07-30T23:25:41.000+0000", "updated": "2018-07-30T23:25:41.000+0000" }, { "id": "439787", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix in SDK 7.3.0.v20180803101103 & 7.4.0.v20180803013445.\r\n\r\nClosing.\r\n\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-03T18:27:44.000+0000", "updated": "2018-08-03T18:27:44.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }