我在Android应用中使用了Google Play服务,因此我的build.gradle
依赖于此。
compile 'com.google.android.gms:play-services:10.2.1'
但Android Studio会显示警告:Avoid using bundled version of Google Play services SDK
。
这个警告意味着什么?我应该如何避免它?我没有找到太多相关信息,搜索了很多内容。
答案 0 :(得分:132)
在6.5之前的Google Play服务版本中,您必须将整个API包编译到您的应用中。在某些情况下,这样做会使您的应用程序中的方法数量(包括框架API,库方法和您自己的代码)在65,536限制下更加困难。 从版本6.5 ,您可以选择性地将Google Play服务API编译到您的应用中
内部编译com.google.android.gms:play-services:12.0.0
包含很多依赖项。请参阅下文..使用play-services可能会导致dex问题和繁重的应用程序。只选择你真正想要的东西:)
Google Play services API Description in build.gradle
Google+ com.google.android.gms:play-services-plus:12.0.0
Google Account Login com.google.android.gms:play-services-auth:12.0.0
Google Actions,
Base Client Library com.google.android.gms:play-services-base:12.0.0
Google Address API com.google.android.gms:play-services-identity:12.0.0
Google Analytics com.google.android.gms:play-services-analytics:12.0.0
Google Awareness com.google.android.gms:play-services-awareness:12.0.0
Google Cast com.google.android.gms:play-services-cast:12.0.0
Google Cloud Messaging com.google.android.gms:play-services-gcm:12.0.0
Google Drive com.google.android.gms:play-services-drive:12.0.0
Google Fit com.google.android.gms:play-services-fitness:12.0.0
Google Location and
Activity Recognition com.google.android.gms:play-services-location:12.0.0
Google Maps com.google.android.gms:play-services-maps:12.0.0
Google Mobile Ads com.google.android.gms:play-services-ads:12.0.0
Google Places com.google.android.gms:play-services-places:12.0.0
Mobile Vision com.google.android.gms:play-services-vision:12.0.0
Google Nearby com.google.android.gms:play-services-nearby:12.0.0
Google Panorama Viewer com.google.android.gms:play-services-panorama:12.0.0
Google Play Game com.google.android.gms:play-services-games:12.0.0
SafetyNet com.google.android.gms:play-services-safetynet:12.0.0
Android Pay com.google.android.gms:play-services-wallet:12.0.0
Android Wear com.google.android.gms:play-services-wearable:12.0.0
火力地堡
Firebase API Description in build.gradle
Analytics com.google.firebase:firebase-core:12.0.0
Realtime Database com.google.firebase:firebase-database:12.0.0
Cloud Firestore com.google.firebase:firebase-firestore:12.0.0
Storage com.google.firebase:firebase-storage:12.0.0
Crash Reporting com.google.firebase:firebase-crash:12.0.0
Authentication com.google.firebase:firebase-auth:12.0.0
Cloud Messaging com.google.firebase:firebase-messaging:12.0.0
Remote Config com.google.firebase:firebase-config:12.0.0
Invites and
Dynamic Links com.google.firebase:firebase-invites:12.0.0
AdMob com.google.firebase:firebase-ads:12.0.0
App Indexing com.google.firebase:firebase-appindexing:12.0.0
Performance Monitoring com.google.firebase:firebase-perf:12.0.0
修改强>
以上版本已被弃用。他们使用个人版本。请参阅下面的链接
Google Play服务 - https://developers.google.com/android/guides/setup
Firebase - https://firebase.google.com/docs/android/setup
答案 1 :(得分:13)
Google Play服务包含许多单独的API。 您可以访问所需的任何内容,而不是访问包含所有这些内容的包。这是更好的方法。见表1 Here