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

Flutter迁移Android 11至12构建失败:已加android:exported仍报错

Android 11迁移至Android 12构建App Bundle失败的解决方案

问题说明

将Flutter项目从Android 11迁移到Android 12时,已完成以下操作:

  • 修改targetSdkVersion为31
  • 在AndroidManifest.xml中为主组件添加android:exported="true"属性

但执行bundleRelease构建App Bundle时,仍然出现Manifest合并错误。

错误日志

/Users/anhdinhhoangquang/mobicloud/android/app/src/main/AndroidManifest.xml:15:9-22:20 Error:
        android:exported needs to be explicitly specified for element <receiver#com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
         *********************************************************
         *********************************************************

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseMainManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

BUILD FAILED in 6s
Running Gradle task 'bundleRelease'...                              6.9s
Gradle task bundleRelease failed with exit code 1

解决步骤

在AndroidManifest.xml中,为报错的com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver接收器显式声明android:exported="true"属性:

<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
            android:exported="true">
</receiver>

项目配置参考

当前build.gradle文件的defaultConfig配置如下:

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.mobifone.mobicloud"
    minSdkVersion 21
    targetSdkVersion 31
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled true
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 17:35:24