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

React Native 0.76提交Google Console遇PendingIntent可变性未指定问题求解

问题分析与解决方案

关联的库

这个错误来自com.google.android.gms.iid.zzaf.zzg,属于Google Play Services Instance ID旧版库,你的项目中是通过react-native-push-notification间接引入的——旧版该推送库依赖了未适配Android 12+的Google Play Services组件,导致创建PendingIntent时未指定可变性标记。

解决步骤

  • 升级react-native-push-notification到最新稳定版
    新版该库已适配Android 12+的PendingIntent可变性要求,执行升级命令:

    npm install react-native-push-notification@latest --save
    # 或使用yarn
    yarn add react-native-push-notification@latest
    
  • 强制统一Google Play Services/Firebase依赖版本
    若升级推送库后问题仍存在,在android/build.gradle的buildscript块中添加版本约束,确保所有依赖使用兼容版本:

    buildscript {
        ext {
            googlePlayServicesVersion = "21.1.0"
            firebaseMessagingVersion = "23.4.1"
        }
        // 保留原有其他配置
    }
    
  • 清理缓存并重建项目
    执行以下命令清理构建缓存,确保新依赖生效:

    cd android && ./gradlew clean
    cd .. && npx react-native run-android
    
  • 移除旧版依赖(若存在)
    检查android/app/build.gradle,如果有直接引用com.google.android.gms:play-services-iid的代码,直接删除该行。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 21:47:03