Coder Thoughts Piotr Mionskowski's thoughts on software, technology, architecture, design patterns and programming in general.

Piotr Mionskowski

Google Play Services is no longer a giant monolith

09 December 2014 android

Nowadays it’s getting harder and harder to build a meaningful app and not rely on Google Play Services to aid us in some commonly required features such as maps, better location provider, geo fencing and so much more. Unfortunately up until now the library shipped as a giant monolith ripping us from one third of dex method limit. For curious reader here’s are method counts in couple of versions:

Version Method Count
3.2.65 6330
4.4.52 16933
5.0.89 20312
6.1.71 23641

and a full breakdown.

Google Play Services 6.5 granular dependency management

Today Google has made the awaited, more than usual, version of their SDK available. With the update apart from new features you can finally depend only on a subset of enormous API. Here’s a table from documentation along with dex method counts:

API Name Gradle depdenency Dex method count
Google Play Services 24525
Google+ 1525
Google Account Login 181
Google Activity Recognition 857
Google App Indexing 482
Google Cast 976
Google Drive 2328
Google Fit 1895
Google Maps 2568
Google Mobile Ads 3278
Google Panorama Viewer 94
Google Play Game services 5046
Google Wallet 1116
Android Wear 1187
Google Actions
Google Analytics
Google Cloud Messaging 5212

A small change to improve build time

For me the biggest win is that in one of the apps we are actively developing granular dependency declaration means with a simple change from

compile ''


compile ''
compile ''
compile ''

I no longer have to run Proguard during development. No wonder my build time just improved by 15 seconds.

This article is cross-posted with my company blog