Featured Posts
 

Tips to Reduse Your Android Application Package Size

BACK
android application package size

Tips to Reduse Your Android Application Package Size

  |   Uncategorized

Android Application Packages are getting bulkier every day. One may opt for the minimalistic approach while regulating the API size reason being an app with concise API size are recorded to be more popular among their competitive obese API apps.

It’s easy to advise but very difficult to adhere to. Considering the cruciality of compact APK size, we at Consagous, an android app development company , are here addressing the most pressing issue of reducing the APK size of your Android Application.

1. Run Proguard

It optimizes and shrinks the code during compilation. Code footprints can be significantly reduced by Code shrinking tools like Proguard. After applying Proguard to the code, one must test the app properly as it replaces the symbols.

Its ‘tree shaking’ feature goes all the paths and detects unused snippets and strips them to create a leaner APK. It also renames fields and classes to make the code lightweight.

2. Vector Drawables

Android is supporting the vector drawable for older Android devices with a release of 23.2 Support Library.

Android Studio provides a way to convert SVG to Vector Drawables. In this, we don’t have to worry about the different device DPI’s. This approach significantly reduces the app size.

3. APK splits

The split mechanism allows you to create the APK for specific density and ABIs. It also allows applications to be built for some forms of multi-APKs more efficiently than using flavors.

4. Google Play Services

In versions of Google Play services before 6.5, one had to compile APIs extensively. In doing so it was often difficult to keep the number of methods under the limit 65536.

From 6.5 version onwards, one can selectively compile Google Play Services API into the app.

5. Optimize PNG images

With the tools, optiPNG or PNGCrush images can be downsized without loss of quality hence slimming the app size.

6. Remove unused resources

Android-resource-remover is a utility that removes unused sources reported by Android Lint from your app.

7. 9-patch images

A Nine patch png is a special format for PNG that can be used for backgrounds. These images are especially useful when designing buttons. A 9patch image defines 9 segments, four corners, four edges and the center. It drastically reduces the app size.

8. Compress JPEG images

With tools like Paint.NET, try and reduce the JPEG files as much as possible.

9. Removable debug Information

It is recommended to you remove all debug-related functionality from the application. Usually, the application use this data, and the Android OS does not require it to run the application.

10. Avoid duplication

It should be ensured that underlying application should not have any duplication in functionality or duplicate assets in an apparent way to avoid unnecessary files to obese the application. Duplicated assets (strings, bitmaps etc) are also a waste of space and must be avoided.

11. Reuse resources whenever possible

Reusing the stuff is the most vital optimization while developing an application. In a RecyclerView or a ListView, reusing helps one to keep scrolling performance smooth. It is also helpful in reducing the final size of APK.

12. Recommended media formats

If the application is rich in images, audio or video, another way the APK size can be reduced is by using certain media formats. Following media formats are recommended:

Images: PNG or JPEG. Use PNGs; since it is a lossless format it is very suitable for textures and artwork. If there are space constraints, use JPEGs or a combination of PNGs and JPEGs.

Audio: AAC Audio is recommended for all audio resources. AAC delivers better compression at a given quality, compared to mp3 or Ogg Vorbis. One should never use Raw formats such as WAV.