【发布时间】:2021-11-19 12:33:28
【问题描述】:
尝试在 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" 添加到所有具有<intent-filters> 的<activity>、<service> 或<receiver> 组件,会在启动时使应用程序崩溃
崩溃日志
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)
【问题讨论】:
-
Strongly consider using FLAG_IMMUTABLE嗯...你已经了吗? -
不,我没有,我不知道在哪里使用这个标志
-
啊哈.. 但是 logcat 会指示代码...或不?可能在您创建没有该标志的 PendingIntent 的服务中。只需在清单文件中注释掉服务即可查看是哪一个。或提供者..
-
这可能来自您正在使用的库。并非所有内容都已为 Android 12 做好准备,您可能还拥有旧版本。无论如何,您可以通过 compileSdk 31 和 targetSdk 30 获得 Android 12 启动屏幕代码并避免这些问题。
-
@blackapps ,是的,我的应用程序中有服务从应用程序启动开始,但没有 logcat 没有提及任何代码或指向代码。它指向待处理的意图类,我将尝试将此标志添加到我的服务中
标签: android android-12