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

AndroidAndroid StudioGoogle Play-Services

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

> 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 alot 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<Br> Firebase - https://firebase.google.com/docs/android/setup<br>

Solution 2 - Android

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFrederick ZhangView Question on Stackoverflow
Solution 1 - AndroidZeroOneView Answer on Stackoverflow
Solution 2 - AndroidSK16View Answer on Stackoverflow