{ "id": "175558", "key": "TIMOB-28149", "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": "21052", "description": "", "name": "Release 9.3.0", "archived": false, "released": true, "releaseDate": "2020-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-11-30T19:10:10.000+0000", "created": "2020-09-22T14:43:14.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "build", "gradle", "library" ], "versions": [ { "id": "20033", "name": "Release 9.0.0", "archived": false, "released": true, "releaseDate": "2020-03-18" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-11-30T19:10:10.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\nIf an app includes the \"Java-WebSocket\" library via gradle (or a module that references it via gradle), then it will fail to build.\r\n\r\n*Steps to reproduce:*\r\n# Create a \"Classic\" Titanium app project.\r\n# Add the below \"build.gradle\" to project folder: {{./platform/android}}\r\n# Build for Android.\r\n\r\n./platform/android/build.gradle\r\n{code:groovy}\r\ndependencies {\r\n\timplementation 'org.java-websocket:Java-WebSocket:1.5.1'\r\n}\r\n{code}\r\n\r\n*Result:*\r\nThe following build failure will occur...\r\n{code}\r\n[ERROR] [GRADLE] java.lang.RuntimeException: Duplicate class org.java_websocket.AbstractWebSocket found in modules jetified-Java-WebSocket-1.5.1.jar (org.java-websocket:Java-WebSocket:1.5.1) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)\r\n{code}\r\n\r\n*Cause:*\r\nTitanium builds with a local \"java_websocket.jar\" below. It's used by V8 for debugging. We need to remove th JAR and instead reference the library via gradle.\r\nhttps://github.com/appcelerator/titanium_mobile/tree/master/android/runtime/v8/lib\r\n\r\n*Work-Around:*\r\nAdd the following \"build.gradle\" to the app project's {{./platform/android}} folder. It will exclude websocket library references from the gradle build to avoid collision with Titanium's local JAR. Although, once we fix this issue, you'll need to remove the below.\r\n{code:groovy}\r\nconfigurations {\r\n\tall {\r\n\t\texclude group: 'org.java-websocket', module: 'Java-WebSocket'\r\n\t}\r\n}\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: App builds fail if it includes \"Java-WebSocket\" library", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1206, "state": "closed", "name": "2020 Sprint 19", "startDate": "2020-09-14T20:01:00.000Z", "endDate": "2020-09-25T20:01:00.000Z", "completeDate": "2020-09-28T15:30:19.875Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "456988", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~hknoechel], our \"ti.socketio\" module was updated in Titanium 9.0.0 to stop using local JARs and reference this library via gradle instead. (We did the same with all of our other modules in 9.0.0 as well.)\r\nhttps://github.com/appcelerator-modules/titanium-socketio/pull/25\r\n\r\nYou must be using a 3rd party module that's bundling its own local websocket JAR (\"Java-WebSocket-1.5.1.jar\"?) and that's the cause of the collision. It needs to be updated to reference it in the \"build.gradle\" similar to how we're doing it below.\r\nhttps://github.com/appcelerator-modules/titanium-socketio/blob/master/android/build.gradle\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-09-22T18:50:23.000+0000", "updated": "2020-09-22T18:50:23.000+0000" }, { "id": "456989", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "We do not use Ti.SocketIO, that's why I'm wondering", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-09-22T18:59:38.000+0000", "updated": "2020-09-22T18:59:38.000+0000" }, { "id": "456991", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hold on. You're right. Titanium has a local web socket JAR used by V8 here...\r\nhttps://github.com/appcelerator/titanium_mobile/tree/master/android/runtime/v8/lib\r\n\r\nI can reproduce the issue you're seeing by setting up a Titanium app with the following \"build.gradle\" file.\r\n{code:groovy}\r\ndependencies {\r\n\timplementation 'org.java-websocket:Java-WebSocket:1.5.1'\r\n}\r\n{code}\r\n\r\nSo, I still think you have a module which is referencing the websocket library, but that module is likely indirectly referencing websockets the \"right\" way via gradle. It's Titanium that needs to change to reference it via gradle as well.\r\n\r\nFor now, you can work-around the issue by adding the following to your app project's \"build.gradle\". This tells the build system to exclude a websocket library gradle dependency. Although once we update Titanium to reference it via gradle too, you'll need to remove the below.\r\n{code:groovy}\r\nconfigurations {\r\n\tall {\r\n\t\texclude group: 'org.java-websocket', module: 'Java-WebSocket'\r\n\t}\r\n}\r\n{code}\r\n\r\nThanks for bringing this up.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-09-22T19:42:04.000+0000", "updated": "2020-09-22T19:42:37.000+0000" }, { "id": "456994", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks Josh! I kept the old version (as an .aar) for now, but it would be great to update it during one of the next releases :)", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-09-22T20:52:06.000+0000", "updated": "2020-09-22T20:52:06.000+0000" }, { "id": "456996", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12119", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-09-22T22:40:38.000+0000", "updated": "2020-09-22T22:40:38.000+0000" }, { "id": "457183", "author": { "name": "ssaddique", "key": "ssaddique", "displayName": "Sohail Saddique", "active": true, "timeZone": "Europe/London" }, "body": "FR passed. Waiting for Jenkins.", "updateAuthor": { "name": "ssaddique", "key": "ssaddique", "displayName": "Sohail Saddique", "active": true, "timeZone": "Europe/London" }, "created": "2020-10-07T14:38:57.000+0000", "updated": "2020-10-07T14:38:57.000+0000" }, { "id": "457743", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-30T19:10:05.000+0000", "updated": "2020-11-30T19:10:05.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }