{ "id": "174705", "key": "AC-6485", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2020-03-03T16:01:48.000+0000", "created": "2020-02-07T18:37:23.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-03-03T16:01:48.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": [], "description": "I have added ffmpeg to an app by using a new module. This module uses a multi architect binary. It is very large (ca. 20MB). After building of app (apk) I see with a debug tool: the binaries are twice in the apk: first under /assets and second under /assets/Resources/ I guess the system uses only one place. Which binary I can remove and why the asset has this two places?", "attachment": [], "flagged": false, "summary": "Reducing APK size", "creator": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "environment": "\r\n\r\n", "comment": { "comments": [ { "id": "454134", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm not really sure what you're doing. If the module is open source, then perhaps you can point us to what it looks like?\r\n\r\nThe only thing that gets duplicated by a module are files you put under its \"assets\" folder. These files are added to APK \"assets\" and as JAR resources. Unfortunately, devs are using it for both purposes and we don't want to break it. In Titanium 9.0.0, we'll be offering a new \"Resources\" folder which will only add files to APK \"assets/Resources\".\r\n{code}\r\n/android/assets\r\n{code}\r\n\r\nIf your module includes prebuilt C/C++ {{\\*.so}} libraries, then they need to go under the following architecture folders. I imagine this is what you want. When you do an app build, it'll copy the {{\\*.so}} libraries to similar folders within the APK, which is where they're supposed to go.\r\n{code}\r\n/android/libs/arm64-v8a\r\n/android/libs/armeabi-v7a\r\n/android/libs/x86\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-08T01:50:46.000+0000", "updated": "2020-02-08T01:50:46.000+0000" }, { "id": "454158", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "In case of ffmpeg the module uses binaries (not *.so). During first run the right binary will copied (and unzipped) and make executable in data folder. In the compiled apk I see the ffmpeg (zipped) binaries in folder /assets *and* in folder /assets/Resources. \r\nhttps://github.com/AppWerft/Ti.FFmpeg/\r\nI guess I can rewmove the version under /assets/Resources. Right?\r\n", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-10T20:25:30.000+0000", "updated": "2020-02-10T20:28:49.000+0000" }, { "id": "454163", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If I understand correctly, your module project has binaries under the following directory. If this is the case, then yes, it will duplicate the files.\r\n{code}\r\n/android/assets\r\n{code}\r\n\r\nWhat you can do instead is move your binaries to the below folder. This folder copies files to APK \"assets\" as well and it won't duplicate the files. This is supported by all Titanium SDK versions. I don't think this folder is documented, but it's what our \"appcelerator.encrypteddatabase\" module uses and we need to maintain backward compatibility. Also note that this copies files to the root \"assets\" folder in the APK. If you want the files to be accessible to Titanium's JavaScript code, you'll need to put your binaries under a \"Resources\" subdirectory (which I think you already know).\r\n{code}\r\n/android/platform/android/bin/assets\r\n{code}\r\n\r\nDoes this help?", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-11T00:31:29.000+0000", "updated": "2020-02-11T00:31:29.000+0000" }, { "id": "454168", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "Maybe it helps. With the module Kroll method loadBinaries() binaries will copied from folder addressed by `getFilesDirectory()`, this is the assets folder directly underneath the module folder. How can I address `/android/platform/android/bin/assets`?\r\nHere the copy process:\r\nhttps://github.com/AppWerft/Ti.FFmpeg/blob/master/android/src/com/github/hiteshsondhi88/libffmpeg/FileUtils.java#L54-L87\r\nAlthough the apk is zipped the zipping of ffmpeg with `zip -9` saves 10MB. I guess it is due the other zip metric of zipalign?", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-11T10:45:41.000+0000", "updated": "2020-02-11T10:45:41.000+0000" }, { "id": "454173", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ah I understand: I have only to move the architecture folder structure to `/android/platform/android/bin/assets`. In the end the binaries are in the same folder, I don't have to modify the copy code. ", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-11T12:51:50.000+0000", "updated": "2020-02-11T12:51:50.000+0000" }, { "id": "454174", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "It works! old apk size 97MB, new 57MB. Maybe I can remove the x86 variant. It is not possible to deliver apks depending on architecture. I can deploy 64bit one, but the 32bit only will rejected. ", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-11T13:05:02.000+0000", "updated": "2020-02-11T13:05:02.000+0000" }, { "id": "454183", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I recommend that you support all architectures in the module and let the app decide which architectures to support.\r\n\r\nIn the \"tiapp.xml\", you can configure which architectures you want as follows. In you\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\r\n\r\n\t\t\r\n\t\t\r\n\r\n\t\t\r\n\t\tarmeabi-v7a,arm64-v8a\r\n\t\r\n\r\n{code}\r\n\r\nAlso note that \"production\" builds exclude {{x86}} by default since it's really only relevant to the emulator. Titanium only adds {{x86}} to APKs when doing test/development builds by default, unless you configure it via your \"tiapp.xml\" as shown above.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-02-11T18:59:51.000+0000", "updated": "2020-02-11T18:59:51.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }