Android Question Download assets via OKHttp2 or similar to reduce APK size

Pete_S

Member
Licensed User
Right now I have 2,000 audio mp3 files included in my Files folder. This is bad because as a result my APK file size is around 50 MB. I want to reduce my APK file size to make it more attractive for users to download.

I would like to put all the mp3 files in 1 big zip file, put it on my web site and then use code to download and unzip it to the assets folder. Maybe using this example:
https://www.b4x.com/android/forum/threads/download-huge-files-with-httputils2.30220/#content

Is this the most clever way to reduce APK file size or should I look at another method?
 

DonManfred

Expert
Licensed User
Longtime User
unzip it to the assets folder
You can not write to Assets folder. It is readonly. You need to extract them on another Path.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
I don't know your app so my comment could be wrong, but from a user perspective the huge space occupied by your app stays the same whether you attach those 2000 files to the apk itself or you download them on a second time.
Why not park them on a server and download just what's needed or what the user selects?

On its start the app could download from a server an updated list of files (e.g. songs' titles) and show it to the user. Then the user highlights what he/she would like to download and your app uses FTP or Download itself to copy from server to device what is asked. You can easily keep track of what was already downloaded so next time your "complete" list could highlight those files already on the device (not needing a new download).

ps: I know that nowadays 50MB is not considered a huge amount of space but I'm old enough to still consider bit coding in order to save a few bytes..

pps: take in consideration that a single download operation (the zip file) could be less demanding on the server than hundreds of small downloads. And the number of expected users and the possibility they download at the same time is to be considered too. I guess that your final decision should depend on the very nature of your project.
 
Upvote 0
Top