{ "id": "174713", "key": "TIMOB-27758", "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": "20033", "name": "Release 9.0.0", "archived": false, "released": true, "releaseDate": "2020-03-18" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-02-14T20:58:38.000+0000", "created": "2020-02-11T05:10:34.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "aar", "android", "breaking-change", "build", "dependencies", "gradle", "module" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-09-28T02:52:03.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\nThe Android gradle build system allows a library project to reference a local AAR for compilation, but it won't merge the local AAR's classes, \"AndroidManifest.xml\", assets, or \"res\" files into the library project's built AAR. This is intentional on Google's end. The build system will only merge all of the AAR files' content into an app project.\r\n\r\nBecause of the above, a native module referencing local AAR files will crash at runtime when built with Titanium 9.0.0 and gradle. It will compile fine, but the classes in the AARs will not be included in the module; nor the app.\r\n\r\n*Solution:*\r\nWhen building a native Android module with Titanium, the CLI should trigger a build failure if the module's \"lib\" directory contains any AAR files and should tell the developer to reference AAR libraries via the \"build.gradle\" file instead.\r\n\r\n*Note:*\r\nThis is a breaking-change. But by doing this, we force module developers to reference dependencies the gradle/maven way, which will solve library version conflict issues between modules.\r\n", "attachment": [], "flagged": false, "summary": "Android: Modules with AARs in \"lib\" directory should trigger a build failure in 9.0.0", "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": "454187", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/11472", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-12T00:34:25.000+0000", "updated": "2020-02-12T00:34:25.000+0000" }, { "id": "454230", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (9.0.x): https://github.com/appcelerator/titanium_mobile/pull/11474", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-12T22:45:23.000+0000", "updated": "2020-02-12T22:45:23.000+0000" }, { "id": "454263", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master and 9_0_X, for 9.0.0 release", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-02-13T18:03:46.000+0000", "updated": "2020-02-13T18:03:46.000+0000" }, { "id": "454290", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix with SDK 9.0.0.v20200214090043.\r\nClosing.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-14T20:58:34.000+0000", "updated": "2020-02-14T20:58:34.000+0000" }, { "id": "459063", "author": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I believe an example would have been better either here or in docs for below use-case:\r\n- How to add AAR/JAR files which are not present on central sites to be added directly in .gradle file.\r\n\r\nThere are multiple instances where projects use private/closed-source AAR and cannot be uploaded on gradle sites.\r\n\r\nThere are online posts which shows how to do it for native Android projects, but finding the same solution for Titanium Android module structure is not an easy way yet.", "updateAuthor": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2021-09-27T12:49:17.000+0000", "updated": "2021-09-27T12:49:17.000+0000" }, { "id": "459064", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "bq. There are online posts which shows how to do it for native Android projects,\r\n\r\nThose \"native\" solutions work for Titanium as well. You would have to copy the private AAR to both the module project and the app project. The issue is nobody like this solution. Not even in a native Android Studio project. Again, this is not a Titanium issue. We're using Google's native gradle build system and it has the same limitations.\r\n\r\nI'll state this again... when a native AAR project (such as your Titanium module project) references a \"local\" AAR as a dependency, Google's gradle build system will \"link\" to the AAR, but it won't \"merge\" the 2 AARs together. The merging of AARs into a single binary only happens when you build an app project. This is how Google's gradle build system works. So, when you look at native solutions online, notice they always force you to reference the private AAR as well as their AAR which depends on it.\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-09-27T17:03:38.000+0000", "updated": "2021-09-27T17:03:38.000+0000" }, { "id": "459065", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Here's a followup on how to use a private AAR with your module project and app project. Note that you have to add it to \"both\" projects.\r\n\r\nIn your module project, create a \"lib-private\" folder and copy your private AAR there.\r\n{{.//android/lib-private}}\r\n\r\nSet up your module's \"build.gradle\" file to link to the above \"lib-private\" folder containing your AAR. Now when you build your module, it will \"link\" to this private AAR at compile time, but it won't merge the private AAR into your module's built AAR. Note that if your private AAR has any public gradle dependencies, they need to be duplicated in your module's \"build.gradle\" because dependency info is not stored in an AAR file.\r\n{{.//android/build.gradle}}\r\n{code:groovy}\r\n// build.gradle\r\ndependencies {\r\n\timplementation fileTree(dir: \"${projectDir}/../../lib-private\", include: ['*.aar'])\r\n}\r\n{code}\r\n\r\nFor the app project, you must also copy the private AAR to the following folder when using your module. Note that Titanium app projects will always include whatever libraries (JARs and AARs) that are in this folder when building your app. The key thing here is Google's build system does \"merge\" all AARs into the app's binary.\r\n{{./platform/android}}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-09-27T21:29:05.000+0000", "updated": "2021-09-27T21:29:05.000+0000" }, { "id": "459066", "author": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Thanks for the detailed explanation. For the app project, do we have to put private AAR files at this location: *\"project-root-folder/app/platform/android/\"* or any other location?\r\n\r\nI honestly think that such deeply hidden info must be available at Guide docs site with example like above showing clearly the folder structure.", "updateAuthor": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2021-09-28T02:52:03.000+0000", "updated": "2021-09-28T02:52:03.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }