使用 Android Studio 4.2.1,在我的 build.gradle 文件中将 sdk 目标更改为 Android 12 后,出现Manifest merger failed with multiple errors, see logs
错误。
选项卡中显示的错误Merged Manifest
如下:
Merging Errors:
Error: 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. My_App.app main manifest (this file)
Error: 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. My_App.app main manifest (this file)
Error: 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. My_App.app main manifest (this file)
但是,该android:exported
标记已应用于我的 AndroidManifest.xml 文件中。我只有一项活动。没有服务或广播接收器。见下文:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mydomain.myapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name="com.mydomain.myapp.MyApplication"
android:allowBackup="false"
tools:replace="allowBackup"
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.mydomain.myapp.ui.MainActivity"
android:exported="true">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>
我的 build.gradle(:app) 文件:
android {
compileSdkVersion("android-S")
buildToolsVersion "30.0.3"
defaultConfig {
...
minSdkVersion 23
targetSdkVersion("S")
...
}
知道如何解决这个问题吗?