You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Genymotion中应用启动崩溃,报Google Play服务及AppMeasurementService错误

嘿,我之前在Genymotion上也踩过这个坑,看你的错误日志,核心问题就是Google Play服务缺失导致Firebase相关组件崩溃了,咱们来一步步解决:

问题根源

Genymotion默认的虚拟机镜像没有预装Google Play服务和Google Play商店,而你的应用依赖Firebase(从日志里的FirebaseInstanceId、AppMeasurementService报错就能看出来)——Firebase的绝大多数核心功能都依赖Google Play服务框架,没有它的话,应用启动时就会触发依赖缺失的崩溃。

具体解决办法

方法1:给现有Genymotion虚拟机安装Google Play服务(推荐)

  • 打开Genymotion,选中你正在使用的虚拟机,点击右侧面板的齿轮图标进入Settings
  • 切换到System标签页,找到Google Play services选项,点击Install按钮

    小提醒:如果你的虚拟机系统版本低于Android 8.0,可能找不到这个选项,建议换成更高版本的虚拟机镜像

  • 安装完成后重启虚拟机,打开Google Play商店登录你的账号,等待服务自动更新到最新版本
  • 重新运行你的应用,应该就能正常启动了

方法2:临时移除Google Play服务依赖(仅用于测试非Firebase功能)

如果你只是想快速测试应用的基础功能,不需要Firebase服务,可以临时修改项目配置:

  1. 打开项目的app/build.gradle文件
  2. 找到所有Firebase相关的依赖,给它们添加排除Google Play服务的配置,示例:
implementation ('com.google.firebase:firebase-analytics:21.3.0') {
    exclude group: 'com.google.android.gms'
}
implementation ('com.google.firebase:firebase-messaging:23.2.0') {
    exclude group: 'com.google.android.gms'
}
  1. 点击Android Studio右上角的Sync Now同步gradle配置
  2. 重新运行应用即可

注意:这种方法会让Firebase的所有功能完全失效,只适合临时测试,正式发布前一定要改回去

方法3:直接使用带Google Play服务的Genymotion镜像

创建新虚拟机时,选择Google Play分类下的镜像(比如「Google Pixel 5 - Android 12.0 (Google Play)」),这类镜像已经预装了完整的Google Play服务和商店,创建完成后直接就能用,不需要额外安装。

内容的提问来源于stack exchange,提问作者Khemraj Sharma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:39:37