android: appcompat makes apps 1 MB bigger

In Android, Appcompat is the support library that is required to use the Action Bar and Status Bar Notifications on a range of older devices. But, if you dont need those features in your app, your app will still carry an extra 1MB in size for no reason at all.

Specifically:

  • NotificationCompat is not needed in Android 4.1 (Jelly Bean) and up. just use the built in Notification methods.
  • ActionBar basic features are available from Android 3 API11, and you dont need the support library for the basic action bar features. But if you want to use Lollipop ActionBar features on older devices, down to Android 2.1 (API7), you need the support library.

Advanced Action bar features can be useful on apps that require compact navigation at the top of the window. Some apps will benefit from this, especially apps that want a ‘hamburger’ menu item (3 horizontal lines that mean there is more options in a popout menu).

Appcompat also allows you to develop apps that look and act like they are part of the Android ecosystem. Google wants your apps to look the part, because it makes android look more capable. If your app doesnt look like the android system, the user knows the functionality of your app doesnt come from android, but your app. In its developer guide, Google encourages the use of appcompat, so that apps can use the latest features on obsolete devices. Old Android devices that will never get updated, can still use googles latest services.

In Android Studio, the Appcompat support library is included by default. It will add about 1 MB to the size of your app. If you dont need to use any of the features it provides, you can remove it from your app.

To remove the appcompat dependencies, delete it from your gradle build file, and you may need to remove or change some of the features it depends on:

  • action bar menu items
  • appcompat themes in the styles.xml file
  • NotificationCompat code
  • supportActionBar
  • etc, follow the trail of build errors….
Advertisements
android: appcompat makes apps 1 MB bigger

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s