美文网首页
微信小程序:requestSubscribeMessage:fa

微信小程序:requestSubscribeMessage:fa

作者: Sarah_Y | 来源:发表于2023-07-20 09:50 被阅读0次

    问题描述:

    在Android Studio中,如果build.gradle中,
    targetSdkVersion 33

    即以 >= android1为目标版本,如果logcat提示以下的错误:
    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.

    根据提示,也就是需要在manifest中的Activity或者广播等加上android:exported="false"
    至于值设为是true还是false,需要自己根据你的需求场景去决定了。

    问题原因:

    如果应用以 >=Android 12 或更高版本为目标平台,且包含使用 intent 过滤器的 activity、服务或广播接收器,您必须为这些应用组件显式声明 android:exported 属性。目的就是Android 12 提高了app和系统的安全性。

    注意事项:

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

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

    注意:对于BroadcastReceiver组件一样,凡是有<intent-filter>标签的组件,都需要加上android:exported
    ————————————————
    版权声明:本文为CSDN博主「碧水逍遥」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/u010231454/article/details/132036339

    相关文章

      网友评论

          本文标题:微信小程序:requestSubscribeMessage:fa

          本文链接:https://www.haomeiwen.com/subject/uzxaudtx.html