我正在努力解决以下错误。
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
即可
但问题是它已经存在于我的环境中,但我仍然收到错误。
我还遗漏了什么吗?
最佳答案
另请注意,
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
因为 intent
是 android.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/