android:exported="true"
,但在将编译SDK和目标SDK版本更新到31后仍然出现以下错误。我还尝试重建项目,使缓存无效并重新启动,但这没有帮助。
错误-当相应组件具有意图过滤器时,面向Android 12及更高版本的应用程序需要为android:exported指定显式值。有关详细信息,请参见https://developer.android.com/guide/topics/manifest/activity-element#exported。
AndroidManifest文件<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xyz.abc">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".framework.presentation.BaseApplication"
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/AppTheme">
<activity android:name="com.xyz.presentation.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
合并清单文件错误。 其他合并的清单文件未包含任何元素 firebase-installations:17.0.0 manifest,versionedparcelable:1.1.1 manifest,runtime:1.0.1 manifest,test:core:1.2.0 manifest......(略)。合并错误:错误:必须显式指定 android:exported 应用程序针对 Android 12 及更高版本需要为具有意图过滤器定义的相应组件指定 android:exported
的显式值。请参见 https://developer.android.com/guide/topics/manifest/activity-element#exported 了解详细信息。 Dairy.app 主清单(此文件)。
android:exported
指定一个明确的值"。 - Android Developer