Wednesday, January 22, 2020

How to reduce Android App size during development?

The rising desires of users motivates developers to incorporate more things in application. Similarly it results into an increased application size. The large size applications frequently transform into storage hoggers in our smartphones causing them to operate slow or hang in the middle of a significant work. As per Google, if the size of an application is more than 150MB, in chances of installation decrease by 30%. The install conversion rate can drop by 1% if size increases by 6 MB. 
Many technology specialists out there work on creating small applications or tools which can reduce the size of an application. Android App Bundle is a publishing tool through which users don’t have to re-download things that are already there in other applications over play Store. This platform is said to decrease the size of an application by 35%. Let us explore other ways to reduce android app size during app development lifecycle.

How to reduce android app size?

How to reduce android app size?

1. Image optimization- 

You can conveniently reduce image size without reducing the resolution. For example, .jpg and .png pictures can be changed over to .webp web picture format to downsize applications without compromising the quality. The .webp format offers lossy compression like .jpg and transparency like .png. There are many tools available for such conversion. Tools like guetzli and packjpg suit .jpg file compression best while pngcrush and zopflipng befit .png files. Designers can implement vector graphics to make simple resolution-independent images that don’t crib for space. These are available in Android as VectorDrawable objects and allow a 100-byte file to generate images sharp and screen-sized.
android {
     defaultConfig {
         vectorDrawables.useSupportLibrary true
     }
 }
It is already known that a few images can do without static resources. The framework is enough to draw such images dynamically at runtime. Utilizing Vector Drawables objects is a brilliant idea when small size applications are to be developed. They can survive on minimal space within the APK file and create pictures compliant with the rules of material design. However, there could be a tussle with regards to CPU and RAM usage as complex objects will in general slow them down.
Also, using the Draw 9-patch tool can saves space. This is a WYSIWYG image editor and probably the coolest approaches to cut image size. The tool lets you make bitmap images that can auto-resize to fit the different screen sizes of various mobile devices. Select parts within the image can be scaled vertically or horizontally depending on the indicators drawn in it.
Another way is to use the aapt tool to crunch .png images, the resources of these are available in res/drawable/. The compression is lossless. For example, a true-color .png image  which needn’t bother with more than 256 colors can be changed over to a color palette enabled 8-bit one. The latter retains the quality yet sheds the size.
Developers must remember that the aapt tool would not compress .png files in the asset/folder. Additionally, it won’t have the option to optimize any image that uses more than 256 colors. Additionally, it may puff up .png files which have just been shrunk. This disadvantage can be avoided by using the cruncherEnabled flag in Gradle as such:
aaptOptions {
    cruncherEnabled = false
}
Read more at-




No comments:

Post a Comment