Expo Android推送通知报错InvalidCredentials:无法获取FCM服务器密钥
我在实现Expo Android推送通知功能时遇到以下错误:
InvalidCredentials: Unable to retrieve the FCM server key for the recipient's app. Make sure you have provided a server key as directed by the Expo FCM documentation.
目前仅Android端存在问题,iOS端尚未尝试。
已完成的操作(遵循Expo官方文档)
- 从Firebase生成Service Account Key
- 将对应JSON文件上传至Expo控制台→项目设置→凭据页面
- 将google-services.json添加至项目根目录,并在app.json中配置:
"android": { "googleServicesFile": "./google-services.json", ... }
当前使用Expo SDK 54,应用内已成功生成推送令牌(Push token)。
尝试过的构建/开发配置
我甚至完全重新创建了Android原生文件夹:
npx expo prebuild npx eas build -p android --profile development --clear-cache
使用以下命令启动应用:
npx expo start --dev-client
推送令牌仍能正常生成,但通知发送始终失败。
失败场景
通过以下两种方式发送通知均失败:
- Expo通知工具
- Expo Push API
返回的错误信息:
{"data":{"status":"error","message":"Unable to retrieve the FCM server key for the recipient's app. Make sure you have provided a server key as directed by the Expo FCM documentation.","details":{"error":"InvalidCredentials","fault":"developer"}}}
请问有没有人在Expo SDK 54 + Android通知场景下遇到过这个问题并找到解决方法?除了上传服务账户JSON和配置google-services.json,是否还有遗漏的额外配置?
内容的提问来源于stack exchange,提问作者Rajvir Singh

