0

I made a small app with my father and we released it to the google play store, after downloading it onto my phone i find out that the app is taking 13.5MB (apk size is 4.5mb or around 5mb full size)

where is the extra space coming from and is there any way to make it smaller?

I already tried making the classes.dex smaller by using minifyenabled but that just seems to crash the app

2 Answers2

0

Similar question how to bring Hello World Android app size down which if you read the comments leads to this: How to stop using AppCompat in Android Studio?

So depending on your minimum SDK level you should look into removing AppCompat library if your goal is to make your app as small as possible.

Morrison Chang
  • 11,691
  • 3
  • 41
  • 77
0

... is there any way to make it smaller?

I already tried making the classes.dex smaller by using minifyenabled but that just seems to crash the app.

Here is my 2 cents. There can be multiple ways to reduce the size.

  1. You can use minifyEnabled as you mentioned. However you'll need to specify to ProGuard to exclude some files in the ProGuard config file. Quoting from documentation of Shrink Your Code:

    To enable code shrinking with ProGuard, you'll need to add minifyEnabled true to the appropriate build type in your build.gradle file. However, it's important that you do enable code shrinking on your final APK used for testing, because it might introduce bugs if you do not sufficiently customize which code to keep.

    Quoting from Customize which code to keep section on the same documentation on which files to keep:

    For some situations, the default ProGuard configuration file (proguard-android.txt) is sufficient and ProGuard removes all—and only—the unused code. However, many situations are difficult for ProGuard to analyze correctly and it might remove code your app actually needs. Some examples of when it might incorrectly remove code include:

    • When your app references a class only from the AndroidManifest.xml file
    • When your app calls a method from the Java Native Interface (JNI)
    • When your app manipulates code at runtime (such as with reflection or introspection)
  2. You can use recent release of App Bundles to reduce the size. Eg: Instead of installing your apk containing all the assets for all densities hdpi, xhdpi, it will dynamically only include the assets required for the specific device, thus reducing the size of the app by quite a bit. From the docs:

    Further reduce the size of your app by installing only the features that the majority of your audience use. And then, with Dynamic Delivery, users can download and install dynamic features when they’re needed.

Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124