{ "id": "164610", "key": "TIMOB-24159", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-11-23T20:19:03.000+0000", "created": "2016-11-20T13:59:08.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "community", "notable", "nullpointer", "service" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-11-23T20:19:19.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": "When working with Android background services this error appears: \r\n\r\n{code:java}\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): (main) [15,652959] Thrown while clearing interval service runners: Attempt to invoke interface method 'void java.util.List.clear()' on a null object reference\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): java.lang.NullPointerException: Attempt to invoke interface method 'void java.util.List.clear()' on a null object reference\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at ti.modules.titanium.android.TiJSIntervalService.destroyRunners(TiJSIntervalService.java:114)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at ti.modules.titanium.android.TiJSIntervalService.onDestroy(TiJSIntervalService.java:125)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at android.app.ActivityThread.handleStopService(ActivityThread.java:4009)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at android.app.ActivityThread.access$2400(ActivityThread.java:210)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1807)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at android.os.Handler.dispatchMessage(Handler.java:102)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at android.os.Looper.loop(Looper.java:145)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at android.app.ActivityThread.main(ActivityThread.java:6938)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at java.lang.reflect.Method.invoke(Native Method)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at java.lang.reflect.Method.invoke(Method.java:372)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)\r\n11-16 09:15:04.549: W/TiJSIntervalService(17859): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)\r\n{code}\r\n\r\nbecause the clear() method is called outside the null-check:\r\nhttps://github.com/appcelerator/titanium_mobile/blob/a8aceeaeee02ed9c8ea70c835a0e78960e254a55/android/modules/android/src/java/ti/modules/titanium/android/TiJSIntervalService.java#L113\r\n\r\n\r\nExample and PR will follow", "attachment": [], "flagged": false, "summary": "Android: Null pointer exception in destroyRunners() of Android.Service", "creator": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium SDK 6.0.0.GA\r\nAndroid", "closedSprints": [ { "id": 752, "state": "closed", "name": "2016 Sprint 23 SDK", "startDate": "2016-11-05T00:39:37.027Z", "endDate": "2016-11-19T01:39:00.000Z", "completeDate": "2016-11-29T06:51:57.887Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "401711", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "app.js\r\n\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({});\r\nvar intent = Titanium.Android.createServiceIntent({\r\n url: 'myservice.js'\r\n});\r\nTitanium.Android.stopService(intent);\r\nvar service = Titanium.Android.createService(intent);\r\nservice.start();\r\nservice.stop();\r\n\r\nwin.open();\r\n{code}\r\n\r\nmyservice.js\r\n\r\n{code:javascript}\r\nvar service = Ti.Android.currentService;\r\n\r\nfunction showNotification() {\r\n var intent = Ti.Android.createIntent({\r\n action: Ti.Android.ACTION_MAIN,\r\n className: 'com.miga.service.VetmedicaActivity',\r\n packageName: 'com.miga.service'\r\n });\r\n intent.flags |= Ti.Android.FLAG_ACTIVITY_CLEAR_TOP | Ti.Android.FLAG_ACTIVITY_NEW_TASK;\r\n intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);\r\n\r\n var pending = Titanium.Android.createPendingIntent({\r\n intent: intent,\r\n flags: Titanium.Android.FLAG_UPDATE_CURRENT\r\n });\r\n\r\n var notification = Titanium.Android.createNotification({\r\n icon: Ti.App.Android.R.drawable.appicon,\r\n contentTitle: \"title\",\r\n contentText: \"text\",\r\n contentIntent: pending\r\n });\r\n \r\n Titanium.Android.NotificationManager.notify(1, notification);\r\n Ti.Android.stopService(intent);\r\n}\r\n\r\nshowNotification();\r\n{code}\r\n\r\ntiapp.xml addition:\r\n{code:xml}\r\n...\r\n\r\n \r\n \r\n \r\n \r\n...\r\n{code}\r\n\r\nPR: https://github.com/appcelerator/titanium_mobile/pull/8634", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-22T20:18:31.000+0000", "updated": "2016-11-22T20:18:31.000+0000" }, { "id": "401714", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Good catch! Assigning to [~gmathews] to review for 6.1.0. Thx!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-22T20:50:07.000+0000", "updated": "2016-11-22T20:50:07.000+0000" }, { "id": "401770", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, was no longer able to see the error caused by Android background services (error shown in the description) on SDK version 6.1.0.v20161123033537.\r\n*Environement*\r\n{code:java}\r\nAppcelerator Command-Line Interface, version 6.0.0\r\nAndroid 7.0 (Google Nexus 6P)\r\nOperating System Name: Mac OS X El Capitan\r\nOperating System Version: 10.11.6\r\nNode.js Version: 4.6.0\r\nnpm: 4.2.8\r\nTitanium CLI Version: 5.0.10\r\nTitanium SDK Version: 6.1.0.v20161123033537\r\nXcode: 8.0\r\nAppcelerator Studio: 4.8.0.201611121409\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-11-23T19:44:46.000+0000", "updated": "2016-11-23T19:45:16.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }