简体   繁体   中英

android:exported needs to be explicitly specified for <activity>

I've explored a lot and i found out that in all the activities we need to specify the android:exported parameter. I've added the param in all my activities in manifest, but i'm still getting this error.

Manifest merger failed: android:exported needs to be explicitly specified for <activity>. 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.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.soptle">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:roundIcon="@drawable/icon"
        android:usesCleartextTraffic="true"
        android:supportsRtl="true"
        android:theme="@style/Theme.Soptle">
        <activity
            android:name=".ManufacturerDetailsActivity"
            android:exported="true" />
        <activity
            android:name=".NotificationActivity"
            android:exported="true" />
        <activity
            android:name=".SearchActivity"
            android:exported="true" />
        <activity
            android:name=".UpdateUserInfoActivity"
            android:exported="true" />
        <activity
            android:name=".OTPverificationActivity"
            android:exported="true" />
        <activity
            android:name=".ViewAllActivity"
            android:exported="true" />
        <activity
            android:name=".MyAddressesActivity"
            android:exported="true" />
        <activity
            android:name=".AddAddressActivity"
            android:exported="true" />
        <activity
            android:name=".DeliveryActivity"
            android:exported="true" />
        <activity
            android:name=".OrderDetailsActivity"
            android:exported="true" />
        <activity
            android:name=".ProductDetailsActivity"
            android:exported="true" />
        <activity
            android:name=".CategoryActivity"
            android:exported="true" />
        <activity
            android:name=".HomeActivity"
            android:exported="true"
            android:label="@string/title_activity_home"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Soptle.NoActionBar" />
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.SplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".RegisterActivity"
            android:exported="true"
            android:screenOrientation="portrait" />

        <meta-data
            android:name="preloaded_fonts"
            android:exported="true"
            android:resource="@array/preloaded_fonts" />
    </application>

</manifest>

adding android:exported="true" to the activity with intent filter in manifest.xml soled the problem for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM