Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 715
Dan Dascalescu Avatar asked Jun 19 '17 02:06

Dan Dascalescu


1 Answers

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
like image 104
statosdotcom Avatar answered Oct 03 '22 08:10

statosdotcom