Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported

本文阐述了Android 12及以上版本的应用必须在manifest文件中为具有intent-filter的组件指定android:exported属性的重要性,确保正确配置以避免安装问题。务必设置exported属性为true,以便外部应用可以启动含有过滤器的Activity。
摘要由CSDN通过智能技术生成

Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined.

原因:如果应用以 Android 12 或更高版本为目标平台,且包含使用 intent 过滤器的 activity、服务或广播接收器,您必须为这些应用组件显式声明 android:exported 属性。
如果未显式声明android:exported 的值,您的应用将无法在搭载 Android 12 或更高版本的设备上进行安装。

在AndroidManifest.xml中带有<intent-filter>的组件需显示声明以下属性:

android:exported=["true" | "false"]

android:exported
此元素设置 Activity 是否可由其他应用的组件启动:
如果设为“true”,那么 Activity 可由任何应用访问,并且可通过其确切类名称启动。
如果设为“false”,则 Activity 只能由同一应用的组件、使用同一用户 ID 的不同应用或具有特权的系统组件启动。 没有 intent 过滤器时,这是默认值。
如果应用中的 Activity 包含 intent 过滤器,请将此元素设置为“true”,以允许其他应用启动该 Activity。例如,假设 Activity 是应用的主要 Activity,并且包含 category“android.intent.category.LAUNCHER”。

如果此元素设为“false”,并且应用尝试启动该 Activity,系统会抛出 ActivityNotFoundException。

  • 6
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值