升级targetSdkVersion到12后AndroidManifest的android:exported错误排查
解决Android 12 targetSdkVersion升级后的Manifest错误
你的问题出在两个未声明android:exported属性的接收器组件上:
com.dieam.reactnativepushnotification.modules.RNPushNotificationActionscom.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
相关产品推荐
相关产品推荐

