尽管安装了 GPS,但模拟器中的 Cordova 应用程序抛出 "HelloMap won't run unless you update Google Play Services"

Cordova Application in Emulator throws "HelloMap won't run unless you update Google Play Services" although GPS are installed

我使用 Android Studio SDK Manager 安装了一些休闲软件:

我用目标创建虚拟设备 Android 6.0 (Google APIs)

问题:

如果我 运行 采样 HelloMap 应用程序,应用程序会提醒我:

为什么?如果我查看 Settings -> Apps -> Google Play Services,它已启用 (v9.0.80)

也许 gradle.build 会有所帮助:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile project(path: "CordovaLib", configuration: "debug")
    releaseCompile project(path: "CordovaLib", configuration: "release")
    compile "com.google.android.gms:play-services-maps:+"
    compile "com.google.android.gms:play-services-location:+"
    // SUB-PROJECT DEPENDENCIES END
}

编辑:

来自 adb logcat 我明白了:

GooglePlayServicesUtil: Google Play services out of date.  Requires 9256000 but found 9080470

现在很清楚,我的 Google Play Services 版本低于系统映像要求的版本。问题是根据 Android Studio 中的 SDK 管理器,GPS 是最新的。

我没有尝试 运行 示例 HelloMap 应用程序,但在使用更新的 Android SDK 构建我的一个应用程序后,我确实遇到了这个错误。

我把plugins/cordova-plugin-googlemaps/plugin.xml改成了:

46         <framework src="com.google.android.gms:play-services-maps:9.0.2" />
47         <framework src="com.google.android.gms:play-services-location:9.0.2" />

之后我删除并重新添加了 android 平台,它开始在模拟器上运行。

我在以下位置找到了一些信息:

http://notnull.co/2016/06/16/android-issues-this-app-wont-run-unless-you-update-google-play-services/

确实如此,这似乎是您升级 google 服务时出现的一个错误,但 android 模拟器并未反映更改。

所以,你还是回去吧,9.0.2就可以了