当我将目标和编译 SDK 版本从 30 更改为 31 时,出现错误。类似于这个问题的东西,但它没有答案。
错误:需要明确指定 android:exported 为 . 面向 Android 12 及更高版本的应用需要为
android:exported
相应组件定义了 Intent 过滤器时指定显式值。有关详细信息,请参阅 https://developer.android.com/guide/topics/manifest/activity-element#exported。
但是所有带有意图过滤器的活动都已经有了andoird:exported
属性。我的机器人清单:
<?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.bsuir.testapp.presentation">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" tools:node="remove" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<application
android:name="com.bsuir.testapp.presentation.App"
android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/Theme.ComposePagination"
android:supportsRtl="true">
<activity
android:name=".screens.launchscreen.SplashScreen"
android:theme="@style/SplashTheme"
android:screenOrientation="portrait"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".screens.history.view.HistoryActivity"
android:label="@string/history_name"
android:theme="@style/Theme.ComposePagination.NoActionBar"
android:screenOrientation="portrait"/>
<activity
android:name=".screens.availabledevices.view.AvailableDevicesActivity"
android:label="@string/devices_name"
android:theme="@style/Theme.ComposePagination.NoActionBar"
android:screenOrientation="portrait"/>
<activity
android:name=".screens.settings.view.SettingsActivity"
android:label="@string/settings_name"
android:theme="@style/Theme.ComposePagination.NoActionBar"
android:screenOrientation="portrait"/>
<activity
android:name=".screens.dashboard.view.DashboardActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>
</application>
</manifest>
什么可能导致错误?