Smaller APK size with large assets? - android

I am creating a simple android app to view a comic book. The pages are large(0.5-1 mb each), high quality .png's and I am loading them into a webview to make use of the built in zoom controls. So far I only have 17 files and the APK size is already about 16 mb. I'm looking to add over 200 files in future updates. I can't really reduce the quality too much because there is small text that must be zoomed-in on to read. Any suggestions? A similar question was posted here: How to reduce App (.apk) Size, but I don't want to lose the quality of the images. I'm not sure if it's appropriate to link to here, but you can have a look at my app by searching for Tracer (by Detour Mobile) on the android market if it helps at all. Thanks in advance.

You could compress them without using lossy compression- e.g. zipping/rarring them, but I don't believe this would gain you much more than a few kilobytes here and there. Otherwise, try using a more compact format than PNG, such as JPEG (you won't lose too much quality.) By the way, all of this was suggested in the referenced post.
If you do decide to scale down the images' size somewhat, be sure to use a method like bicubic sharper- it tends to look better than others when reducing image size.
Another option would be to download the images for the comic that is being read on-the-fly with pre-fetching so reading would not be interrupted as much.

Consider placing your images in Assets folder as opposed to Res. The big difference is, Assets content won't be compiled into R.java class so you will see major storage savings. You'd have to modify your code though as you won't be able to call up the images via the regular r.resID notation, but it's doable

android offers a new way to deal with it.
android app bundle apk size has a maximum size of 150mb
but you can use an asset pack to seperate the apk from the static files
and upload your app
here is a more detailed explanation about asset packs:
https://developer.android.com/guide/playcore/asset-delivery
here is the guide for integrating asset packs with regular android app:
https://developer.android.com/guide/playcore/asset-delivery/integrate-java

Related

How to reduce Android app size by compressing images?

I am developing an Android app which has hundreds of .jpg files (over 300) each one of around 40kB. I would like to know if there is a way of reducing the size of my app. I looked at a similar question here Reducing Android App Size, but the problem still exists. Is there perhaps a way to compress the images and decompress them in real time when needed, or any other way to make my app more space efficient while not sacrificing speed?
If you have used tinypng for every resource you did your best with this kind of solution. In general, it's better to use vector graphics where the general icon will be <1kb. Also, a vector resource can be animated. If it's quite simply bitmaps, you can generate them in code on demand. Also, you can divide your app by dynamic features and each will be downloaded on demand with their part of the resources.
Is there perhaps a way to compress the images and decompress them in real-time when needed?
There is no standard Android solution out of the box. Probably, you can write something on your own. But this looks like too much effort.
Still, the most practical solution: use vector graphics as max as possible, generate in code what you can generate, compress with tinypng the others. That should be enough or you should have a very good reason for making some extra work.
For more info about vector graphics in android. For standard vector graphic import right in the android studio.
Web-site where you can download icons and insert them into the project.

Android image size reduction

I got an app which is loaded with many image files which takes much place. The app can also download more pictures from different sources. Is there a way to compress their size?
I remember there was maybe some sort of library created by Google specifically for this issue?

How to store large number of .png images in android drawable?

I'm new in android and I'm working on a project where i'm using more than 50 images which includes icons and background images. As per android doc, for responsive UI I have to store each image in 4 format i.e. hdpi, mdpi, xdpi and xxdpi. I followed the same but after that I noticed that there are 200 images in my drawable folder(50*4). So my question is whether Im doing right thing or not? because it increases my project size.
whether Im doing right thing?
Absolutely not if you store this 200 images inside your app than your app size is too much high and no one can download the app also there is some performance issue so this is not the right thing at all
Answer 1 -
Best way is to use fontawesome these will generate image from your ttf file dynamically you just need font.ttf file but disadvantages in this approach is there is less number of font/images available for free version if you want more number of images than you have to pay you can refer this
Answer 2 -
Go for Cloud storage means you need to store your image in one of cloud storage than download from cloud they provide API for upload as well as download images refer this But ill suggest you to go for cloudinary.com i have used this and easy to implement API , API for nearly all Languages and Its Free Free Free .......
Best of luck
You have to try the vector drawable images. It contains the code path, so automatically it will expend to all size.
for more info
https://developer.android.com/guide/topics/graphics/vector-drawable-resources.html
https://developer.android.com/studio/write/vector-asset-studio.html

Is there any recommended number of files/Images to be stored within Android project?

What is the correct way to store files within Android Project?
All files in local folders? All in webserver? 50/50 ?
The reason I am asking is because my project's size has been increasing a lot due to the number of drawables and I am afraid I should do something about it.
Can this compromise the app performance?
The large app size i.e. apk file size might not compromise your app performance but, will certainly make it slower to install your app. From the user's perspective, if two apps provide same features and have similar performance the size of their apk files will be the deciding factor for them to install your app.
Using web server to save drawables can be an efficient way if your app is a web based app. In case, your app does not require web access or internet access for any other purpose, don't save drawables on the web server.
However, I would suggest you to reduce the size of your drawable files in such a way that their quality is not effected. All this can be achieved by help of tools like Photoshop (I have personally not tried this but know that it is possible).
You can also use nine-patch drawables. These drawable files can stretch themselves along the sides specified without compromising the image's quality. For more info on the same visit following links:
http://developer.android.com/tools/help/draw9patch.html
http://developer.android.com/reference/android/graphics/drawable/NinePatchDrawable.html
Also, make sure that your icons are of specifications as specified in the Material Design Guidelines. Visit the link for more details: https://www.google.com/design/spec/style/icons.html#

My .apk is 273MB because of my images for animation, isn't that too much?

I never saw an app that is 273MB, I have to be doing something wrong; I have 75 pngs for an animation. An app is not supposed to be that big, right?
Your app can definitely be that size. Many games are huge in size. You'll have to use the APK expansion files method provided by google for this. See here:
https://developer.android.com/guide/google/play/expansion-files.html
You'll have to store them on the SD card as they'll be too big for internal memory.
Also consider compression or smaller file sizes as alternatives although this depends highly on what you plan to do with your images (if it's very important that the images be high-res, then don't compress).
From the Google Play website the maximum allowed size for the APK on Google Play is 50 MB but you can use expansion files mechanism if you need more data (2GB per file)
I'd suggest you though to find a way to use fewer PNG images or optimize it somehow...
You can put your images on a server and first time entering your app download them on the sdcard. You'll know better if this fits your application :)

Categories

Resources