App size increased by 3 times,How to reduce it

Viewed 1087

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.

3 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.

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.

Certain libraries must be installed according to the processor models of the phones. When you publish as an App Bundle. It will be sufficient to load the resources according to the user's phone.

Related