java - list 合并失败 : android:exported needs to be explicitly specified for <activity>

标签 java android android-manifest

我的 list 文件有问题,错误消息:

Manifest merger failed : android: exported needs to be explicitly specified for . 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.


我的安卓 list :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyTheme">
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:exported="true"
            android:name=".Activities.SplashScreenActivity"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        </activity>
    </application>

</manifest>
这个post描述了一个解决方案,但它不起作用或者我做错了什么。也许有人有类似的问题,请告诉我如何解决。

最佳答案

  • 降级或升级到以前的 sdk 版本,然后重建项目。
  • 打开你项目的AndroidManifest.xml .
  • 单击合并 list 选项卡 [在窗口底部]
  • 找出<activity>其中包括 <intent-filter>标签缺少 android:exported属性
  • 如果找到然后右键单击并按Go to Declaration然后添加 android:exported Activity 标签的属性
  • 重建项目

  • 希望它会奏效。这个对我有用。

    关于java - list 合并失败 : android:exported needs to be explicitly specified for <activity>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69497972/

    相关文章:

    java - 类型不匹配无法从 String 转换为 int

    java - 获取 Java 列表列表中的值

    Java 线程转储汇总工具

    android - 在 android 中使用图像按钮时,应用程序无法启动并崩溃

    java - 将参数传递给不同公共(public)类中的构造函数的问题

    android - (动态)多个微调器州/市

    android - 从主应用程序 Android 启动 Activity 模块

    Android Intent-filter 适用于 Magic,但没有 Hero,可能是什么问题?

    android - Androgurus 的 2 个基本问题......有人可以指导我吗

    xamarin.android - 具有特定权限的 Monodroid 失败 [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]