如何使用Google Play Services 6.5粒度依赖关系管理

时间:2014-12-08 07:52:57

标签: android google-play-services

此问题不再有效。但答案可能仍然对其他人有用,所以我会留在这里。


原始问题:

在11月17日的blogpost中,Google员工推出了期待已久的粒度依赖管理(以应对dex方法限制)。我们有12月8日,我仍然无法下载sdk(6.1是最新的),也没有获得有关如何引入粒度依赖的文档。关于这一个的任何消息?或者在官方发布之前如何获得它?

3 个答案:

答案 0 :(得分:68)

注意!

不再维持这个答案,因为Google现在正在做很好的发布。在Android Developers Blogofficial release notes上发布帖子,并在YouTube channel上发布视频,并简要概述新内容。

我会留下最后两篇(截至撰写时)更新和原始答案。请查看以前的更新here

2016年10月更新,Play Services 9.8.0

Google Play Services Release NotesGoogle Maps APIs Release Notes

support-v4依赖

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

2016年5月更新,Play Services 9.0.1

Blog PostGoogle Play Services Release NotesGoogle 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

2015年12月更新,Play Services 8.4.0

Blog PostVideoGoogle Play Services Release NotesGoogle 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依赖

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

2015年8月更新,Play Services 7.8.0

Google Play Services Release NotesGoogle Maps APIs Release Notes

support-v4依赖

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

原始答案

他们刚刚被释放(见highlights)。您可以找到有关如何使用粒度依赖关系的更多信息here

您需要使用SDK提供的SDK管理器更新您当地的Google Play Services存储库,或者使用Jake Whartons sdk-manager-plugin等插件为Gradle自动更新。使用Gradle构建时看起来像这样:

Google Play Services repository outdated. Downloading update...

编辑1

截至编写时,第二个链接似乎已损坏,即使在下拉菜单中选择了使用Android Studio ,它也不会显示信息,至少对我而言。要查看Android Studio的信息,请选择使用其他内容,然后再次选择使用Android Studio

编辑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依赖

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

编辑3

Google刚刚撰写了一篇关于Google Play Services 6.5 and the 65k method limit的博客文章。它包含我的帖子等信息。我只会为通过SO而不是博客文章发现此信息的任何人引用一个段落:

  

注意:在撰写本文时,使用的正确版本是6.5.87。由于这是一个非常精细的数字,它会很快更新,因此请确保在编码时检查最新版本。通常人们会使用'+'来表示版本,例如6.5。+以使用最新的6.5版本。但是,通常不鼓励使用“+”,因为它可能导致不一致。

答案 1 :(得分:4)

Android网站缺少文档。

appstate不包括在内,如果您使用的是游戏助手,那么您就是这样做了

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'

来自post

答案 2 :(得分:3)

我在SDK maven repo周围进行了挖掘以解决这个问题,到目前为止它似乎对我有用。以下目录包含拆分依赖项:<path-to-sdk>/extras/google/m2repository/com/google/android/gms/

我解压缩了一些AAR,内容表明play-services包含所有内容,play-services-base包含您可以构建的最低要求,包括其他依赖项(例如play-services-location,{{1 },play-services-maps)。

您的依赖项部分可能如下所示:

play-services-wallet