Android按需添加Google Play服务

以前无论使用何种Google Play服务,都是直接在gradle文件中引用一个库。

compile 'com.google.android.gms:play-services:9.4.0'

这直接导致放法数超过了65535,后来发现从6.5版本以后是可以按需引用的,如下:

compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'

第一个是广告库,第二个是使用Google账号登陆用的授权库,第三个是Google Cloud相关库。这样应用程序会瘦身很多。

各种库的详细列表在这里

原文地址:https://www.cnblogs.com/graphics/p/5859196.html