viernes, enero 15, 2016

Cambios en Google Play Services | Compilación de API selectiva

Si reciben este error luego de actualizar parte del SDK de Android
Error:Execution failed for task ':app:compileReleaseJavaWithJavac'. java.io.FileNotFoundException: C:....\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (The system cannot find the path specified)
Quiere decir que deben aplicar cambios en las dependencias de sus proyectos. A partir de la versión 6.5 de Google Play services (GPS) los paquetes de la API se compilan selectivamente, esto quiere decir que hay que agregar sólo lo que nos interesa para nuestro proyecto, esto ayuda a reducir el limite de los 65.536 métodos que seguramente les pasó luego de agregar la librería de GPS. Entonces, ahora en vez de compilar
compile 'com.google.android.gms:play-services:8.4.0
Puedes incluir, como en mi caso sólo Google Cloud Messaging
com.google.android.gms:play-services-gcm:8.4.0
A continuación una tabla con cada uno de los paquetes de la API de GPS. Table 1. Individual APIs and corresponding build.gradle descriptions.

Table 1 shows a list of the separate APIs that you can include when compiling your app, and how to describe them in your build.gradle file. Some APIs do not have a separate library; include them by including the base library. (This lib is automatically included when you include an API that does have a separate library.)

Table 1. Individual APIs and corresponding build.gradle descriptions.

Google Play services API Description in build.gradle
Google+ com.google.android.gms:play-services-plus:8.4.0
Google Account Login com.google.android.gms:play-services-auth:8.4.0
Google Actions, Base Client Library com.google.android.gms:play-services-base:8.4.0
Google Address API com.google.android.gms:play-services-identity:8.4.0
Google App Indexing com.google.android.gms:play-services-appindexing:8.4.0
Google App Invites com.google.android.gms:play-services-appinvite:8.4.0
Google Analytics com.google.android.gms:play-services-analytics:8.4.0
Google Cast com.google.android.gms:play-services-cast:8.4.0
Google Cloud Messaging com.google.android.gms:play-services-gcm:8.4.0
Google Drive com.google.android.gms:play-services-drive:8.4.0
Google Fit com.google.android.gms:play-services-fitness:8.4.0
Google Location, Activity Recognition, and Places com.google.android.gms:play-services-location:8.4.0
Google Maps com.google.android.gms:play-services-maps:8.4.0
Google Mobile Ads com.google.android.gms:play-services-ads:8.4.0
Mobile Vision com.google.android.gms:play-services-vision:8.4.0
Google Nearby com.google.android.gms:play-services-nearby:8.4.0
Google Panorama Viewer com.google.android.gms:play-services-panorama:8.4.0
Google Play Game services com.google.android.gms:play-services-games:8.4.0
SafetyNet com.google.android.gms:play-services-safetynet:8.4.0
Google Wallet com.google.android.gms:play-services-wallet:8.4.0
Android Wear com.google.android.gms:play-services-wearable:8.4.0

Saludos, para ver la información completa ve a https://developers.google.com/android/guides/setup