Michał Klimczak
Michał Klimczak

Reputation: 13154

How to use Google Play Services 6.5 granular dependency management

This question is no longer valid. But answers may still be useful for others, so I will leave it here.


Original question:

In a blogpost from 17 november, Google guys introduced long awaited granular dependency management (to cope with dex method limit). We have december 8th and I still cannot download the sdk (6.1 is the latest available), nor get the documentation on how to introduce granular dependency. Any news on this one? Or an idea how to get it before it's officialy released?

Upvotes: 29

Views: 17391

Answers (3)

aried3r
aried3r

Reputation: 1118

Note!

I will no longer be maintaining this answer, because Google is doing a very good job at doing the releases now. With a post on their Android Developers Blog, official release notes and often also a video on their YouTube channel with a short overview of what's new.

I'll leave the last two (as of writing) updates and the original answer. Please find the previous updates here

Update October 2016, Play Services 9.8.0

Google Play Services Release Notes, Google Maps APIs Release Notes

support-v4 dependency

com.google.android.gms:play-services-base:9.8.0
-> com.google.android.gms:play-services-basement:9.8.0
  -> com.android.support:support-v4:24.0.0 -> 24.2.1

Update May 2016, Play Services 9.0.1

Blog Post, Google Play Services Release Notes, Google Maps APIs Release Notes

# Google+
compile com.google.android.gms:play-services-plus:9.0.1
# Google Account Login
compile com.google.android.gms:play-services-auth:9.0.1
# Google Actions, Base Client Library
compile com.google.android.gms:play-services-base:9.0.1
# Google Address API
compile com.google.android.gms:play-services-identity:9.0.1
# Google App Indexing
compile com.google.android.gms:play-services-appindexing:9.0.1
# Google App Invites
compile com.google.android.gms:play-services-appinvite:9.0.1
# Google Analytics
compile com.google.android.gms:play-services-analytics:9.0.1
# Google Cast
compile com.google.android.gms:play-services-cast:9.0.1
# Google Cloud Messaging
compile com.google.android.gms:play-services-gcm:9.0.1
# Google Drive
compile com.google.android.gms:play-services-drive:9.0.1
# Google Fit
compile com.google.android.gms:play-services-fitness:9.0.1
# Google Location, Activity Recognition, and Places
compile com.google.android.gms:play-services-location:9.0.1
# Google Maps
compile com.google.android.gms:play-services-maps:9.0.1
# Google Mobile Ads
compile com.google.android.gms:play-services-ads:9.0.1
# Mobile Vision
compile com.google.android.gms:play-services-vision:9.0.1
# Google Nearby
compile com.google.android.gms:play-services-nearby:9.0.1
# Google Panorama Viewer
compile com.google.android.gms:play-services-panorama:9.0.1
# Google Play Game services
compile com.google.android.gms:play-services-games:9.0.1
# SafetyNet
compile com.google.android.gms:play-services-safetynet:9.0.1
# Android Pay
compile com.google.android.gms:play-services-wallet:9.0.1
# Android Wear
compile com.google.android.gms:play-services-wearable:9.0.1

Update December 2015, Play Services 8.4.0

Blog Post, Video, Google Play Services Release Notes, Google Maps APIs Release Notes

dependencies {
    # Google+   
    compile com.google.android.gms:play-services-plus:8.4.0
    # Google Account Login  
    compile com.google.android.gms:play-services-auth:8.4.0
    # Google Actions, Base Client Library   
    compile com.google.android.gms:play-services-base:8.4.0
    # Google Address API    
    compile com.google.android.gms:play-services-identity:8.4.0
    # Google App Indexing   
    compile com.google.android.gms:play-services-appindexing:8.4.0
    # Google App Invites    
    compile com.google.android.gms:play-services-appinvite:8.4.0
    # Google Analytics  
    compile com.google.android.gms:play-services-analytics:8.4.0
    # Google Cast   
    compile com.google.android.gms:play-services-cast:8.4.0
    # Google Cloud Messaging    
    compile com.google.android.gms:play-services-gcm:8.4.0
    # Google Drive  
    compile com.google.android.gms:play-services-drive:8.4.0
    # Google Fit    
    compile com.google.android.gms:play-services-fitness:8.4.0
    # Google Location, Activity Recognition, and Places 
    compile com.google.android.gms:play-services-location:8.4.0
    # Google Maps   
    compile com.google.android.gms:play-services-maps:8.4.0
    # Google Mobile Ads 
    compile com.google.android.gms:play-services-ads:8.4.0
    # Mobile Vision 
    compile com.google.android.gms:play-services-vision:8.4.0
    # Google Nearby 
    compile com.google.android.gms:play-services-nearby:8.4.0
    # Google Panorama Viewer    
    compile com.google.android.gms:play-services-panorama:8.4.0
    # Google Play # Game services   
    compile com.google.android.gms:play-services-games:8.4.0
    # SafetyNet 
    compile com.google.android.gms:play-services-safetynet:8.4.0
    # Google Wallet 
    compile com.google.android.gms:play-services-wallet:8.4.0
    # Android Wear  
    compile com.google.android.gms:play-services-wearable:8.4.0
}

support-v4 dependency

com.google.android.gms:play-services-base:8.4.0
-> com.google.android.gms:play-services-basement:8.4.0
  -> com.android.support:support-v4:23.0.0 -> 23.4.0

Update August 2015, Play Services 7.8.0

Google Play Services Release Notes, Google Maps APIs Release Notes

support-v4 dependency

com.google.android.gms:play-services-base:7.8.0
-> com.android.support:support-v4:22.2.0 -> 22.2.1

Original answer

They have just been released (see the highlights). You can find more information on how to use the granular dependencies here.

You will need to update your local Google Play Services repository using the SDK Manager provided by the SDK or use a plugin like Jake Whartons sdk-manager-plugin for Gradle which will automatically update it for you. It would look like this when building with Gradle:

Google Play Services repository outdated. Downloading update...

Edit 1

As of writing, the second link seem to be corrupt, as in, even though Using Android Studio is selected in the drop down menu, it doesn't show the information, at least for me. In order to see the information for Android Studio, select Using something else, then select Using Android Studio again.

Edit 2

Google Maps APIs Release Notes

dependencies {
    # Google+'
    compile 'com.google.android.gms:play-services-plus:6.5.+'
    # Google Account Login
    compile 'com.google.android.gms:play-services-identity:6.5.+'
    # Google Activity Recognition
    compile 'com.google.android.gms:play-services-location:6.5.+'
    # Google App Indexing
    compile 'com.google.android.gms:play-services-appindexing:6.5.+'
    # Google Cast
    compile 'com.google.android.gms:play-services-cast:6.5.+'
    # Google Drive
    compile 'com.google.android.gms:play-services-drive:6.5.+'
    # Google Fit
    compile 'com.google.android.gms:play-services-fitness:6.5.+'
    # Google Maps
    compile 'com.google.android.gms:play-services-maps:6.5.+'
    # Google Mobile Ads
    compile 'com.google.android.gms:play-services-ads:6.5.+'
    # Google Panorama Viewer
    compile 'com.google.android.gms:play-services-panorama:6.5.+'
    # Google Play Game services
    compile 'com.google.android.gms:play-services-games:6.5.+'
    # Google Wallet
    compile 'com.google.android.gms:play-services-wallet:6.5.+'
    # Android Wear
    compile 'com.google.android.gms:play-services-wearable:6.5.+'
    # Google Actions
    # Google Analytics
    # Google Cloud Messaging
    compile 'com.google.android.gms:play-services-base:6.5.+'
}

support-v4 dependency

com.google.android.gms:play-services-base:6.5.87
-> com.android.support:support-v4:21.0.0 -> 21.0.3

Edit 3

Google just made a blog post about Google Play Services 6.5 and the 65k method limit. It contains the information of my post and more. I'll just quote one paragraph for anyone who comes across this information via SO instead of the blog post:

Note: At the time of writing, the correct version to use is 6.5.87. As this is a very granular number, it will get updated quite quickly, so be sure the check the latest version when you are coding. Often people will use a ‘+’ to denote versions, such as 6.5.+ to use the latest 6.5 build. However, it’s typically discouraged to use a ‘+’ as it can lead to inconsistencies.

Upvotes: 68

Michael Pardo
Michael Pardo

Reputation: 2600

I dug around the SDK maven repo to figure this out, and it seems to be working for me so far. The following directory contains the split dependencies: <path-to-sdk>/extras/google/m2repository/com/google/android/gms/.

I unzipped some AARs and the contents suggest that play-services contains everything and play-services-basecontains the minimum requirements which you can build upon by including the other dependencies (e.g. play-services-location, play-services-maps, play-services-wallet).

Your dependencies section might look like this:

dependencies {
    compile 'com.google.android.gms:play-services-location:6.5.87'
    compile 'com.google.android.gms:play-services-maps:6.5.87'
    compile 'com.google.android.gms:play-services-wallet:6.5.87'
}

Upvotes: 3

cesards
cesards

Reputation: 16329

There is a lack of documentation in Android site.

appstate is not included, and if you're using Game Helpers you're fuc***

compile 'com.google.android.gms:play-services-ads:6.5.87'
compile 'com.google.android.gms:play-services-all-wear:6.5.87'
compile 'com.google.android.gms:play-services-appindexing:6.5.87'
compile 'com.google.android.gms:play-services-appstate:6.5.87'
compile 'com.google.android.gms:play-services-base:6.5.87'
compile 'com.google.android.gms:play-services-cast:6.5.87'
compile 'com.google.android.gms:play-services-drive:6.5.87'
compile 'com.google.android.gms:play-services-fitness:6.5.87'
compile 'com.google.android.gms:play-services-games:6.5.87'
compile 'com.google.android.gms:play-services-identity:6.5.87'
compile 'com.google.android.gms:play-services-location:6.5.87'
compile 'com.google.android.gms:play-services-maps:6.5.87'
compile 'com.google.android.gms:play-services-panorama:6.5.87'
compile 'com.google.android.gms:play-services-plus:6.5.87'
compile 'com.google.android.gms:play-services-wallet:6.5.87'
compile 'com.google.android.gms:play-services-wearable:6.5.87'

from this post

Upvotes: 4

Related Questions