【问题标题】:MapFragment doesn't work because of Google Play Services Failure由于 Google Play 服务失败,MapFragment 无法工作
【发布时间】:2017-10-03 19:20:27
【问题描述】:

我有一个在我的 Activity 中动态显示的 MapFragment。

但它说我必须更新 Google Play 服务。我已经通过更新依赖项来做到这一点,但它不起作用。

有什么想法吗?

这是我的 Gradle 文件:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-v4:25.1.0'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:10.2.0'

}

我的片段:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="ibas.locatix_teamviewer.mapFragment">

<com.google.android.gms.maps.MapView
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_marginTop="12dp"
    android:id="@+id/mapView"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

这是我的活动:

【问题讨论】:

标签: android android-fragments google-play-services


【解决方案1】:

您设备上的 google play-services 版本已过期。只需点击更新按钮,您就可以在您的设备上从 Play 商店下载最新版本。

编辑: Stackoverflow 上有这样的 similar questions。 您可能会发现这些问题和答案很有用。

根据documentation,您的模拟器也应该使用 Android 4.2.2 或更高版本。

要在使用 Google Play 服务 SDK 时测试您的应用,您必须使用:

  • 运行 Android 4.0 或更高版本并包含 Google Play 商店的兼容 Android 设备。

-带有 AVD 的 Android 模拟器,运行基于 Android 4.2.2 或更高版本的 Google API 平台。

【讨论】:

  • 当我点击“更新”时,应用程序崩溃了……怎么办?
  • @skm 你有哪个设备,哪个安卓版本?
  • 在我自己的设备 (Samsung s6) 上它工作正常,但在模拟器 (AVD) 中它只显示播放服务必须更新的信息......当我点击更新时它崩溃了。跨度>
猜你喜欢
  • 1970-01-01
  • 2016-02-11
  • 1970-01-01
  • 1970-01-01
  • 2013-05-01
  • 1970-01-01
  • 2014-07-02
  • 2014-04-09
  • 2017-05-18
相关资源
最近更新 更多