android - 无法安装应用程序:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED android 12
问题描述
尝试在 android 12 设备中安装应用程序时出现以下错误。
Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
错误
Installation failed due to: 'INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1707272647.tmp/base.apk (at Binary XML file line #98): aero.sita.airsideapp.activities.MainActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'
具有以下目标并编译 sdk 版本
compileSdkVersion: 31,
buildToolsVersion: "28.0.2",
minSdkVersion : 16,
targetSdkVersion : 31,
将版本降低到 30 可以正常工作,但是我不能使用android:windowSplashScreenBackground
android 12 设备的启动屏幕背景更改参数
编辑:添加android:exported="true"
到所有 <activity>
,<service>
或<receiver>
组件中<intent-filters>
, 启动时应用程序崩溃
崩溃日志
java.lang.IllegalArgumentException: aero.sita.airsideapp.oneapp: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:273)
at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:151)
at androidx.work.impl.utils.ForceStopRunnable.forceStopRunnable(ForceStopRunnable.java:171)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:102)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
解决方案
INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
您需要在清单条目中包含一个明确的android:exported
值,这些值构成您的应用程序的入口点。
将版本降低到 30 可以正常工作,但是我不能使用 android:windowSplashScreenBackground 启动屏幕背景更改参数用于 android 12 设备
您可以将 Android 12 splashscreen API 与 compileSdk 31 一起使用,并通过使用 targetSdk 30 来避免 PendingIntent 问题。
java.lang.IllegalArgumentException:aero.sita.airsideapp.oneapp:定位 S+(版本 31 及更高版本)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一。强烈考虑使用 FLAG_IMMUTABLE,仅当某些功能依赖于 PendingIntent 是可变的时才使用 FLAG_MUTABLE,例如,如果它需要与内联回复或气泡一起使用。
根据您的堆栈跟踪,这来自androidx-work库。如果您的目标是 SDK 级别 31,则至少需要版本 2.7.0。版本 2.7.0 仍处于测试阶段。如果您更喜欢依赖项的稳定版本,请使用版本 2.6.0 和 targetSdk 30。
推荐阅读
- matlab - 如何从 MATLAB 中的矩阵创建子矩阵(全部 5*5)?
- html - 内容未正确填充 CSS 网格列
- c - 遍历数组似乎不起作用
- sql - 为什么两个数字上的 UNION 比它们的总和更有效?
- python - QueryDict 中的 Django Post 请求中没有返回值
- sql-server - 在作业中使用 sp_add_jobstep 向该作业添加步骤实际上并没有运行添加的步骤?
- sql - 正则表达式 spring-jdbc (postgres) 中的命名参数
- git - BITBUCKET - 分享回购或转让回购
- for-loop - 阅读语句“if (x[i][0])”。
- angular - Bootstrap 不工作且不显示数据(Angular)