Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App size increased by 3 times,How to reduce it

Tags:

android

apk

size

I make a Android app.It have 2 Activities and 10 fragments.This is my first time to publish a app.When i first analyze the app its of small size.when i try to install through that apk.Device say its only for test.

First Time analyze

When i build a apk and than analyze it, its size increase by 3 times.

analyze after build

I am confused why my app size increase.

like image 551
Sahil Goyal Avatar asked Sep 17 '25 12:09

Sahil Goyal


2 Answers

The both screenshots how the reason: the first version contains only libraries for armv7 (32bit) and the other screenshots shows that the libraries for x86, armv7 and armv8 are included. The library has 11 to 15MB and including it three times increases of course the app size.

As each device only requires one of the libraries you can reduce the download size by splitting up your app into an app-bundle. An bundelized app is split into several parts and if a user installs the app Google Play downloads only those parts needed for the current device. Therefore only one of the three libraries would be loaded.

like image 76
Robert Avatar answered Sep 20 '25 02:09

Robert


It seems that you used a native library for your app. The thing is, that native libraries are platorm-specific. A native ARM library can not be used for x86, and vice versa.

This way, Android Studio has to build the native library for the three more common architectures for Android: ARMv7, ARMv8, and x86. Hence the size increase. You can't - and should not - remove the extra architectures, because this can result in the app not working on some devices. This kind of size increase is unavoidable with the APK format.

Android App Bundles solve this problem by only downloading what's needed for the device. The guide on how to publish as a bundle is in the link.

like image 40
CoderCharmander Avatar answered Sep 20 '25 01:09

CoderCharmander