Flutter Android 12 使用 intent-filter 时安装错误

Flutter Android 12 install error when using intent-filter

我正在为以下错误而苦恼。

adb: failed to install F:\xxx\src\FlutterDemoApp\FlutterDemoApp\build\app\outputs\flutter-apk\app.
apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1942767517.tmp/base.apk (at Binary XML file line #102): 

com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]
Error launching application on Pixel 4 XL.


正如我在 Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present] and 发现的,这只是将 android:exported="true" 添加到 android/app/src/main/AndroidManifest.xml

但问题是它已经存在于我的环境中,但我仍然收到错误。
我还漏掉了什么吗?

我尝试按照评论中的建议清理项目并将包名称更改为小写。但没有任何效果。 以下是对我有用的。希望有人对此有所帮助。

我必须为我的 build.gradle

添加 Multi Dex 支持
    defaultConfig {
    applicationId "com.example.demo_app"
    minSdkVersion 19
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled = true //★This
}

dependencies {
implementation("androidx.multidex:multidex:2.0.1")//★This
implementation 'org.altbeacon:android-beacon-library:2.19'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

}

不确定为什么会这样,但您可以在此处阅读更多内容 https://developer.android.com/studio/build/multidex

也记在笔记里,

Starting from Android 12 (SDK 31) and when using intent-filter, the attribut android:exported must be set explicitly to false or true. Without this attribut the application wouldn't be able to be installed. References:

资源: (contains the warning about installing an application without this attribut on Android 12 or higher)

创建 new flutter project 时,默认 AndroidManifest.xml 应包含设置为 trueattribute,因为 intentandroid.intent.category.LAUNCHER:

        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="..."
            android:hardwareAccelerated="true"
            android:exported="true"        <== SHOULD BE ADDED
            android:windowSoftInputMode="adjustResize">