6

see this question Application is not installed error, when launched from home screen shortcut

AndroidManifest.xml :

<application
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/Theme.AppTheme">
        <activity
                android:name=".ui.activity.MainActivity"
                android:screenOrientation="fullSensor"
                android:label="@string/app_name"
                android:exported="true"
                android:configChanges="orientation|screenSize">
            <intent-filter
                    >
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter
                    >
                <action android:name="android.intent.action.VIEW"/>
                <data android:scheme="app" android:host="appname"
                />
                <category android:name="android.intent.category.BROWSABLE"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <nav-graph android:value="@navigation/nav_graph_main"
                    />
        </activity>
</application>

Gradle [App] :

defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 19
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

i'm get this error :

> Task :app:processDebugMainManifest FAILED
/home/mhrohani/IdeaProjects/PrjName/app/src/main/AndroidManifest.xml Error:
    android:exported needs to be explicitly specified for <receiver>. 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.
/home/mhrohani/IdeaProjects/PrjName/app/src/main/AndroidManifest.xml Error:
    android:exported needs to be explicitly specified for <receiver>. 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.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


Execution failed for task ':app:processDebugMainManifest'.

Project and android studio configs :

Gradle :                 ** 7.1.1 **  
Android Gradle Plugin :  ** 7.0.0 **  
Android Studio Version : ** Arctic fox 2020.3.1 **  
OS :                     ** Linux Ubuntu **

I'm try rebuild and sync project but does not working.

3
  • 2
    android:exported needs to be explicitly specified for <receiver> – It's not really clear what your specific question is, but that message is saying that the error(s) are in a <receiver> element, not that <activity>.
    – Mike M.
    Commented Aug 9, 2021 at 14:46
  • im not have <receiver> tag in manifest xml At first I thought it was navigation-component problem but after deleting it I got the same error again . in <nav-graph android:value="@navigation/nav_graph_main" /> Why did I act before receiving this error, considering that I put another question link, but instead of solving another problem? im complete manifest file in question . see it .
    – MH-Rouhani
    Commented Aug 9, 2021 at 15:19
  • Mouaad Abdelghafour AITALI , How do I fix the error?
    – MH-Rouhani
    Commented Aug 9, 2021 at 15:25

1 Answer 1

2

Please note the error text

android:exported needs to be explicitly specified for receiver

This means you have to look for receiver in main/dependencies manifest, if you find this tag on main manifest, you have to add the value of android:exported and if you can't find receiver tag inside the main manifest, then you should search inside other dependencies manifests, I will show you step by step

1- Open manifest file on Android Studio

2- At the bottom click on Merged Manifest

3- Open all the dependencies manifests in order and look for that does not contain a android:exported

4- I'm sure this tag will be found, after finding it just copy the whole tag and add it in the main manifest, do not forget to add the value of android:exported to it

Example:

receiver tag inside one of dependencies manifest file:

<receiver
        android:name="com.moduletop.push.UserPresentBroadcastReceiver"
        android:enabled="false" >
        <intent-filter>
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
</receiver>

Add this tag inside main manifest:

<receiver
        tools:node="merge"
        android:exported="false"
        android:name="com.moduletop.push.UserPresentBroadcastReceiver"
        android:enabled="false" >
        <intent-filter>
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
</receiver>
2
  • Cafebazaar dependencies had created this problem . i called with them and it solved . thanks Mr. nadimi :)
    – MH-Rouhani
    Commented May 31, 2022 at 12:37
  • Your welcome, you can use github.com/MrNadimi/CafeBazzarTools for Cafebazaar payments,
    – Nadimibox
    Commented Jun 1, 2022 at 8:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.