I recently developed two android apps to help my colleagues and I at HTGF manage our large portfolio and investor network. The apps are pretty simple, just a search field and a list of results, with the relevant information displayed when you select a contact or startup (contact details, company history, etc). The problem was, I planned to import both the contacts and the portfolio list SQLLite databases, but each had so much information that the resulting DBs were about 5MB each.
Android compresses Resources and Assets in order to make the resulting APK smaller, but it imposes a 1MB limit (I’ve heard this is larger now) to what it will compress. Any file larger, and the Android Asset Packaging Tool (aapt) refuses to compile/build the APK.
For most developers, this is not a big deal, since typically you wouldn’t want to have that size Assets anyway since you’d preferably keep the DB up to date on a server and have it update the App information when called. But there were two problems with this for our internal use-case: i) we wanted it to work offline, and ii) for data security reasons we weren’t going to put any confidential startup information on an internet-accessible server (the security audit would have been so much work we’d have rather just not had the app). So installing the DB as an Asset within the APK on the initial installation was the only way to go.
I eventually discovered that there are some file types which aren’t automatically compressed during the build, specifically files that have already been compressed or do not compress easily. “.JPEG” is one such file, so the easy solution was to rename the SQLLite DB to “database.jpeg”, since SQLiteOpenHelper doesn’t care what the file is called so long as it’s consistent.
Since then, I’ve been able to use much larger assets simply by called them X.jpeg instead of their normal extension and aapt assumes they are already compressed files. No problems, they are simply built into the APK as is!