close

[Solved] android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify

Hello Guys, How are you all? Hope You all Are Fine. Today I Just Updated my Emulator and android SDK and just after the update I am not able to run my simple hello world project Now and I am facing the following error android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify in java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify Error Occurs ?

I Just Updated my Emulator and android SDK and just after the update I am not able to run my simple hello world project Now and I am facing the following error.

***Manifest merger failed: 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.***

How To solve android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify Error ?

  1. How To solve android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify Error?

    To solve android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify Error To run your apps on Android 12 You just need to specify android:exported=”false” or android:exported=”true”. And your manifest will look like

  2. android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify

    To Solve android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify Error To run your apps on Android 12 You just need to specify android:exported=”false” or android:exported=”true”. And your manifest will look like

Solution 1: Specify android:exported=”false” or android:exported=”true” in androidmenifest

To run your apps on Android 12 You just need to specify android:exported="false" or android:exported="true". And your manifest will look like

<activity
          android:name=".MainActivity"
          android:exported="true"
          android:theme="@style/Theme.MyApplication.NoActionBar">
          <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
          </intent-filter>
    </activity>

Solution 2: set target sdk for 30

  1. First of all set target sdk for 30
  2. Then go to the merged manifest
  3. find if there’s any activity, service, receiver or provider that does not have exported set target sdk for 31
  4. override all the entries you found like this:
<receiver android:name="<name_of_the_entry>"
                android:exported="false or true"
                tools:node="merge" />

Solution 3: add androidx.test.ext:junit

Try to add androidx.test.ext:junit in your compose.ui dependencies.

androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment