Android应用程序向后兼容版本的google play services API

Android应用程序向后兼容版本的google play services API,android,android-gradle-plugin,google-play-services,google-maps-android-api-2,mobile-application,Android,Android Gradle Plugin,Google Play Services,Google Maps Android Api 2,Mobile Application,当我在安卓手机4.4版(棒棒糖)上部署我的安卓应用程序时,我收到一条消息:“除非你更新谷歌play服务,否则应用程序不会运行。” 我看了看我的android手机,发现Google play services的版本是5.1.89。我知道在我的代码中我使用的是8.4.0 我不希望android向用户显示弹出窗口来更新google play服务 安卓移动应用专家能帮我解决这个问题吗。 如何在不要求用户更新谷歌服务的情况下使我的应用程序向后兼容 我的身材如下 apply plugin: 'com.a

当我在安卓手机4.4版(棒棒糖)上部署我的安卓应用程序时,我收到一条消息:“除非你更新谷歌play服务,否则应用程序不会运行。”

我看了看我的android手机,发现Google play services的版本是5.1.89。我知道在我的代码中我使用的是8.4.0

我不希望android向用户显示弹出窗口来更新google play服务

安卓移动应用专家能帮我解决这个问题吗。 如何在不要求用户更新谷歌服务的情况下使我的应用程序向后兼容

我的身材如下

  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'
}

如中所述,该服务由两部分组成:在构建时链接到应用程序的客户端库,以及客户端库使用进程间通信(IPC)连接到的Google Play services APK

如果您希望使用Google Play服务的新功能,或者遇到在以后版本中修复的错误,通常只需要升级客户端库

Google Play services APK作为后台服务运行,为您的应用程序提供实际的Google服务。通过这种拆分模式,谷歌可以迅速向终端用户设备推出新功能、服务更新和关键缺陷修复,而无需等待运营商或设备制造商实施这些修复

因此,Google Play services APK必须与以前发布的客户端库版本向后兼容,以避免每次更新时破坏开发人员的应用程序

然而,事实并非如此。如果使用特定版本的客户端库构建应用程序,则安装的Google Play services APK版本不得早于该版本

因此,如果您根据库版本5.1.89构建,您的应用程序将与APK的8.4.0版本兼容,但如果安装的版本是,例如5.0.0,则不会


一个表现良好的应用程序总是在访问服务之前检查已安装的Google Play services APK的可用性和版本,如Google Play services中所述。当终端用户被提示在设备上更新Google Play服务时,这正是您在实际操作中看到的,作为应用程序开发人员,这是您所能做的最好的事情,因为您不能在终端用户的设备上强制更新,否则您的应用程序将崩溃。

这是不可避免的。否则会降低你的版本,尽管这会牺牲一些功能,那些旧的bug会再次出现。试着在你的
build.gradle
中添加
compile'com.google.android.gms:play services:5.0.+”
如果我设置为5.0.+,我的应用程序会在android手机上运行吗?谷歌服务8.4.0的棉花糖版本,如果我降级,我的应用程序会在更高版本的android上运行吗?google play services和8.4.+?嗨,Indramurari,我试着用5.0.+编译,结果出错了。我看起来需要给出正确的版本名,如5.0.89。当我查看/m2repository/时,我的计算机中没有5.0.89版。我该如何下载google play 5.0.89?因此,它不向后兼容,为什么你要为一个非常简单的问题解释这么多?