Dan Dascalescu
Dan Dascalescu

Reputation: 151926

What makes the minified Hello World Android APK so large - 800KB?

This isn't a general gripe about the bloat of Android apps nowadays*, but a very specific question:

If you install Android Studio 2.3.3 and create the "Hello world" sample app (as described in the Building your first app official tutorial), then build a release APK, the resulting file is 825KB (I tested this on Linux, but I suspect the output is the same on other OSes).

Android Hello world release build

I've already enabled ProGuard and there are no images or other resources.

What goes in that APK by default?

Why?

How can that bloat be taken out?

By comparison, in 2013 a Hello World app was under 10Kb.

* I remember when decent fully-functional apps were a few hundred KBs, and by comparison a PWA like Uber is 1% the size of the corresponding Android app

Upvotes: 6

Views: 372

Answers (2)

Dan Dascalescu
Dan Dascalescu

Reputation: 151926

Turns out that by removing all sorts of resources and using insane compression, an empty APK can be brought down to 678 bytes (!).

Thanks to Udayraj Deshmukh for pointing out a blog post detailing how to reduce an Android APK's size by 99.99%.

Upvotes: 0

Exclude all AppCompat libraries and you will see size decrease to about 100kb.

appcompat v7 is automatically attached even if you do not use it at all

In your build.gradle, exclude from "dependencies": compile 'com.android.support:appcompat-v7:26.+

You'll also have to edit res\values\styles.xml to become only this:

<resources><style name="AppTheme" parent="android:Theme.Light"></style></resources>

(make sure to remove the <!-- Customize your theme here. --> lines). Also, in MainActivity.java, change the extends AppCompatActivity part to

public class MainActivity extends Activity

Upvotes: 6

Related Questions