Does “play-services:9.8.0” include “play-services-location:9.8.0”?

只谈情不闲聊 提交于 2019-12-08 14:05:07

问题


I am upgrading an App, and in my build.gradle file, I have this:

dependencies {
    ..........
    compile 'com.google.android.gms:play-services:9.8.0'
    ..........
}

In the Android SDK Setup Quickstart Guide Urban Airship provides, they offer this as a sample code:

dependencies {
    ..........
    // Recommended for location services
    compile 'com.google.android.gms:play-services-location:9.8.0'
    ..........
}

If I use "play-services:9.8.0" I would assume it would also include "play-services-location:9.8.0" because "play-services-location:9.8.0" should be a subset of "play-services:9.8.0", but I wanted to confirm. Do you know if this is a correct assumption? Thank you.


回答1:


Yes, play-services is the full bundle. They were broken apart to reduce the method count of your app so you don't hit the dex limit. More information can be found here.




回答2:


From Google Api Documentation

you can use the latest Google play service api:

 dependencies {
    compile 'com.google.android.gms:play-services:10.2.1'
}

If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them.

To Selectively compiling APIs into your executable:

 compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-plus:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-games:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'

the detail lists are provided in the documentation.



来源:https://stackoverflow.com/questions/43123539/does-play-services9-8-0-include-play-services-location9-8-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!