3

I updated one of my apps a few months ago to version 8.3.0 of Google Play services, and that version broke backwards compatibility for some location related APIs.

So my question is, if my device already had Google Play services 8.3.0 installed even when I was running my app using version 6.5.87, how is it possible that it was still working? (Given that the APIs on 6.5.87 are no longer available on 8.3.0) Do devices keep older versions of Google Play services to support backwards compatibility? Or are the removed APIs somehow available on the installed version of Google Play services and hidden on the library shared with developers?

What I'm trying to understand here is if updating Google Play services on my app actually brings background improvements to the app (like using the latest algorithms in the library), or if those improvements are already available as soon as the device installs the new Google Play services version.

EDIT:

After looking into this in more detail I saw that no APIs were actually broke, however some interfaces were converted into abstract classes (see https://developers.google.com/android/guides/releases#september_2015_-_v81) and that is what caused the compilation issues I had back then.

The issue I had happened because version 8.1 of Google Play services was no longer compatible with older versions (because of the change mentioned above), so all the libraries I was using had to be built with 8.1+, if one of them was built with an older version then the compilation failed with this error:

java.lang.IncompatibleClassChangeError: The method 'boolean com.google.android.gms.common.api.GoogleApiClient.isConnected()' was expected to be of type interface but instead was found to be of type virtual (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)

EDIT 2:

Even though the issue I faced was not about removed APIs, I found an example of an API that was removed on Google Play services version 7: GooglePlayServicesClient (see Cannot resolve symbol 'GooglePlayServicesClient').

Community
  • 1
  • 1
Franco
  • 2,711
  • 2
  • 20
  • 27

2 Answers2

0

its not automatically available for your app

when update Google play service version you must have to update your app with new version of Google play service code only then your app have new algorithm


if your app have old version of Google play service & device have new version: don't worry your app works fine because your app already have Google play service code in your APK.(device don't keep old version code of Google Play service when update to new one).


if your app have new version of Google play service & device have old: then you must have to ask user update Google play service in his/her device then your app work fine in his/her device


so, its not necessary to device must have more then one version of Google Play service


EDITED: 12-01-2015

I already give you answer of this but still i w'll give you example

I have used Google play service(v 7.8.0) in my app for Location(com.google.android.gms:play-services-location:7.8.0) and for maps(com.google.android.gms:play-services-maps:7.8.0) and current Google Play service Version is 8.4.0 still my app working file why? because some of google play service code attach with my APP code see image below.

enter image description here

I have extract code from APK file. see Google play service code available with APK see package name com.google.android.gms that's why my app wok fine without any issue.

you can also generate your app code see this answer for more detail;

Community
  • 1
  • 1
Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177
  • I don't think you understood my point, how about when I am using version 6.5 on my app and my device has 8.3? 8.3 broke backwards compatibility for some APIs, yet my app works fine, how can that be given the scenarios you explained? – Franco Jan 12 '16 at 10:49
  • My bad, no APIs were actually broke, only the type of some method changed, probably because some interfaces were converted into abstract classes on version 8.1 (as explained here https://developers.google.com/android/guides/releases#september_2015_-_v81), I added more info on my question. – Franco Jan 12 '16 at 11:12
  • yes your answer is correct, but not for the issue I was having. I already knew the theory of what you explained (saw it on the Google documentation). But in practice when I tried to integrate libraries to my app that were compiled with versions older than 8.1 I had a compilation issue (I edited my question now to give more information about the core issue I faced), and that is what I'm talking about. Sorry for the confusion before about the APIs thing. – Franco Jan 12 '16 at 11:27
  • I just added another edit with an example of an API that was removed on version 7. Right now I have an app using Google Play services 6.5 and a device with Google Play services 8.4 installed. The app is using the `GooglePlayServicesClient` class, which is not available on version 8.4 of Google Play services. – Franco Jan 12 '16 at 12:17
  • @Franco: if you generate APK with new Play service Library added in Gradel file then you must have to modify your code like GooglePlayServicesClient not available then there is new way to implement that. check this answer http://stackoverflow.com/q/29303427/1168654 – Dhaval Parmar Jan 12 '16 at 13:22
  • yes I am aware of how to fix this, I already fixed it long ago. What I'm trying to understand is how can it be that when my app had version 6.5 using `GooglePlayServicesClient` and my phone version 8.3 (which doesn't have that class) it all worked fine?? Thanks for your help, but if you can't answer that question then you are not answering what I asked and I don't have time to keep trying to explain it. – Franco Jan 12 '16 at 14:35
0

In the release notes of of Google Play Services 8.3 I don't see any note on API calls not available anymore. My guess is that the calls are just deprecated and not removed.

Aitor Viana
  • 933
  • 6
  • 15
  • you are actually right about that, I got confused cause a co-worker was having a similar issue that I had a while back and I misunderstood it. What did change on version 8, which broke backwards compatibility, is the type of a method. I edited my question with the error log. – Franco Jan 12 '16 at 11:01
  • I found out that on version 7 however a class was removed from Google Play services, yet my app using that class and running on version 8.3 of Google Play services worked fine :/ (check my second edit). – Franco Jan 12 '16 at 14:37