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

使用Expo API集成FCM推送时,expo build:android报错求助

Expo集成FCM推送通知配置错误修复

执行expo build:android时出现以下错误:

Error: Problem validating fields in app.json. Learn more: https://docs.expo.dev/workflow/configuration/
• Field: android - should NOT have additional property 'androidServicesFile'.
Couldn't publish because errors were found. (See logs above.) Please fix the errors and try again.

问题原因

androidServicesFile是Expo配置根层级的属性,并非android子对象下的配置项,你把它放错了位置。另外你的app.json还存在语法错误:ios配置块缺少闭合的}。

修正后的app.json配置

{
  "expo": {
    "name": "TestApp",
    "slug": "testApp",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/images/logo.png",
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "package": "test.app",
      "versionCode": 1,
      "useNextNotificationsApi": true
    },
    "androidServicesFile": "./google-services.json",
    "web": {
      "favicon": "./assets/favicon.png"
    }
  }
}

关键修改点

  • 将androidServicesFile移至expo配置的根层级,与ios、android同级
  • 补全ios配置块的闭合},修复JSON语法错误

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 20:25:11