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

升级targetSdkVersion到12后AndroidManifest的android:exported错误排查

解决Android 12 targetSdkVersion升级后的Manifest错误

你的问题出在两个未声明android:exported属性的接收器组件上:

  • com.dieam.reactnativepushnotification.modules.RNPushNotificationActions
  • com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher

虽然你的Manifest里没给这两个接收器显式添加intent-filter,但react-native-push-notification库在编译阶段会自动为它们注入intent-filter,触发了Android 12的强制规则:所有带有intent-filter的组件必须明确指定android:exported值。

修改方案

给这两个接收器添加android:exported="false"(它们属于应用内部组件,不需要被外部应用调用):

<receiver 
    android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions"
    android:exported="false"/>
<receiver 
    android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher"
    android:exported="false"/>

额外检查

确保所有带有intent-filter的组件(Activity、Receiver、Service)都明确设置了android:exported:

  • 像启动页MainActivity这类需要被系统或外部调用的组件,设置为android:exported="true"
  • 仅应用内部使用的组件(如推送监听服务、内部接收器)设置为android:exported="false"

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 02:05:23