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

Flutter构建报错:需为flutterlocalnotifications接收器指定android:exported

解决Flutter项目Gradle构建失败:ScheduledNotificationBootReceiver需指定android:exported属性

这个接收器是flutter_local_notifications插件自带的,会在Gradle构建时自动合并到你的项目主AndroidManifest.xml中,所以你自己的Manifest里看不到它。要解决这个问题,你需要在**自己项目的AndroidManifest.xml**中显式声明这个接收器并指定android:exported属性,具体操作如下:

  • 打开项目中android/app/src/main/AndroidManifest.xml文件
  • 在<application>标签内部添加以下代码:
<receiver
    android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
    android:exported="false">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
    </intent-filter>
</receiver>

这里设置android:exported="false"是因为该接收器仅处理应用内部的系统启动广播,不需要对外暴露给其他应用。添加后重新运行项目,Gradle构建失败的问题应该就能解决。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.20 04:01:08