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

Flutter应用Play Store Api完整性警告问题求助(firebase_auth 4.4.0)

解决Flutter firebase_auth导致Play Store API完整性警告的可行方案

核心问题背景

firebase_auth 4.4.0版本默认集成了play-services-safetynet,而Play Store当前对SafetyNet相关API的合规性要求更严格,因此触发了API完整性警告。以下是几种优先级从高到低的解决方案:

1. 升级firebase_auth到最新稳定版(官方最优解)

Firebase团队在后续版本(如firebase_auth: ^5.0.0及以上)已移除对play-services-safetynet的依赖,改用符合Play Store最新要求的Play Integrity API。这是最彻底、最安全的修复方式,完全符合官方规范。

  • 操作步骤:
    1. 修改pubspec.yaml中的firebase_auth版本为最新稳定版(可通过flutter pub outdated查看可用版本)
    2. 执行flutter pub get同步依赖
    3. 若使用Firebase其他服务,建议配合Firebase BOM统一版本,避免依赖冲突:
      dependencies:
        firebase_core: ^2.24.0
        firebase_auth: ^10.7.0
      dependency_overrides:
        firebase_bom: ^32.8.0
      

2. 暂不升级时,精准排除依赖(替代方案)

若因项目兼容性问题暂时无法升级,不建议使用全局configurations.all排除,可针对firebase_auth的Android端依赖精准排除,避免误删其他潜在依赖:

  • 在android/app/build.gradle中修改依赖配置:
    dependencies {
      implementation platform('com.google.firebase:firebase-bom:32.0.0')
      implementation 'com.google.firebase:firebase-auth'
      // 仅针对firebase_auth_android排除safetynet
      implementation('io.flutter.plugins.firebase.auth:firebase_auth_android') {
        exclude group: 'com.google.android.gms', module: 'play-services-safetynet'
      }
    }
    
  • 验证:执行./gradlew app:dependencies,确认play-services-safetynet已从依赖树中移除

3. 验证修复效果

完成上述操作后:

  • 重新构建签名的APK/AAB包
  • 上传至Play Store发布验证页面,检查API完整性警告是否消失

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 22:45:14