How to suppress the "Avoid using bundled version of Google Play services SDK" warning?
Asked Answered
B

2

72

I'm using the Google Play services in my Android app so I have the dependency in my build.gradle.

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

But Android Studio shows a warning for it: Avoid using bundled version of Google Play services SDK.

Android warning

What does this warning mean? How should I avoid it? I've googled a lot without finding much related info.

Bestir answered 14/4, 2017 at 7:40 Comment(4)
it is because play-services has contains alot of dependencies inside it.. look here.. developers.google.com/android/guides/setup.. choose any dependencies you want to use instead of using all of them.Wootten
@Wootten Cool. Thanks for your quick response. Could you please add an answer to the question so I can accept it?Bestir
I wasn't aware of it. As I went over some tutorial and didn't realize how bad this was when running Gradle. I am so glad to discover this early on my project.Tetroxide
As to me, I do not need finally any GooglePlay service; after reading ZeroOne's comment, I removed: implementation 'com.google.android.gms:play-services:12.0.1' in Gradle, then APK release size has been lessened by 3MB.. thank youAlgol
W
163

In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit. From version 6.5, you can instead selectively compile Google Play service APIs into your app

Inside compile com.google.android.gms:play-services:12.0.0 contains a lot of dependencies.. see below.. using play-services may cause dex problem and heavy app. Select only which want do you really depends to :)

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

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   

EDIT Above version is already deprecated. They use individual versioning. Please refer Link Below

Google Play Service - https://developers.google.com/android/guides/setup
Firebase - https://firebase.google.com/docs/android/setup

Wootten answered 14/4, 2017 at 7:48 Comment(2)
Google Cloud Messaging is depreciated. use Firebase Massaging instead.Huntley
@ZeroOne...How can I get the latest version of all the dependencies?Earwig
K
14

Google play services contain many individual APIs. You can access whichever you require instead of accessing a bundle containing all of them. It's better approach. See Table No. 1 Here

Kimbro answered 14/4, 2017 at 7:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.