09 December 2014
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:
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||com.google.android.gms:play-services:6.5.87||24525|
|Google Account Login||com.google.android.gms:play-services-identity:6.5.87||181|
|Google Activity Recognition||com.google.android.gms:play-services-location:6.5.87||857|
|Google App Indexing||com.google.android.gms:play-services-appindexing:6.5.87||482|
|Google Mobile Ads||com.google.android.gms:play-services-ads:6.5.87||3278|
|Google Panorama Viewer||com.google.android.gms:play-services-panorama:6.5.87||94|
|Google Play Game services||com.google.android.gms:play-services-games:6.5.87||5046|
Google Cloud Messaging
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 'com.google.android.gms:play-services-maps:6.5.87' compile 'com.google.android.gms:play-services-location:6.5.87' compile 'com.google.android.gms:play-services-base:6.5.87'
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