使用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
相关产品推荐
相关产品推荐

