Reputation: 103
when I deploy my android app on android mobile version 4.4 (lollipop), I am getting a message that "app won't run unless you update Google play services"
I looked at my android mobile and can see that Google play services version is 5.1.89. I know in my code I am using 8.4.0
I don't want android to show popup to user to update google play services
can any android mobile app expert help me fix this issue. how do I make my app backward compatible without asking user to update google services?
my build.gradle is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildTypes {
debug {
debuggable true
}
}
defaultConfig {
applicationId "com.me"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
}
Upvotes: 1
Views: 1276
Reputation: 714
As described in the Google Play Services overview, the service consists of two parts: the client library that is linked into the application at build time, as well as the Google Play services APK, to which the client library connects using inter-process communication (IPC).
You generally only need to upgrade the client library if you wish to use new features of Google Play Services or if you're hit by a bug that is fixed in a later release.
The Google Play services APK runs as a background service that provides the actual Google services to your application. With this split model, Google can promptly push out new features, service updates and critical bug fixes to end-user devices without needing to wait for carriers or device manufacturers to implement these fixes.
As a consequence, the Google Play services APK has to be backwards compatible with previously released versions of the client library to avoid breaking developer's applications each time it is updated.
The opposite, however, is not true. If you build your application using a specific version of the client library the installed Google Play services APK version must not be older than that.
So if you build against library version 5.1.89 your app will work with version 8.4.0 of the APK, but won't if the installed version is, e.g., 5.0.0.
A well behaved application always checks the availability and version of the installed Google Play services APK before accessing a service, as explained in the Google Play services setup guide. This is exactly what you see in action when the end user is prompted to update Google Play Services on the device, and it's the best you as an application developer can do, since you can't force an update on the end user's device and the alternative would be to have your application crash.
Upvotes: 3