使用意图过滤器时 Flutter Android 12 安装错误

标签 flutter android-manifest intentfilter android-12

我正在努力解决以下错误。

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] 中找到的那样和 Android Studio error: "Manifest merger failed: Apps targeting Android 12"只需将 android:exported="true" 添加到 android/app/src/main/AndroidManifest.xml
即可
但问题是它已经存在于我的环境中,但我仍然收到错误。
我还遗漏了什么吗?

enter image description here

最佳答案

另请注意,

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)

当创建新的flutter项目时,默认的AndroidManifest.xml应包含此属性并设置为true因为 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">

关于使用意图过滤器时 Flutter Android 12 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71854399/

相关文章:

Android 权限 BLUETOOTH list 错误

android - 如何使用 ACTION_PACKAGE_FIRST_LAUNCH intent-filter 启动应用程序?

dart - 如果类型化函数不返回值,Dart 分析器不应该显示警告吗?

datetime - Flutter - 将分钟转换为 H :M

java - 为什么即使 **intent-filter** 具有标签属性,应用程序的名称仍与主要 Activity 标签的名称相同

java - Android SMS 广播接收器不起作用

android - 方案主机无法在 android Lollipop 上运行,单击链接以打开应用程序

flutter - 如何在 Windows 中以 html 形式查看代码覆盖率?

firebase - 如何根据用户auth uid授予对Google云存储桶的访问权限

android - android :configChanges ="screenSize" attribute do?是什么意思