Android Studio, updating build.gradle TargetSdkVersion 31 issues

Issue

We are using targetSdkVersion 30, I am trying to update it to 31

When I set targetSdkVersion to 31, I am unable to run/compile the app because it is failing build error in manifest.xml saying

android:exported needs to be explicitly specified for . 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. src/main/AndroidManifest.xml

I checked my manifest file, I added android:exported = true/false for every activity , receiver!

I do not have issue if I set targeted SDK version to 30, but 31
and I am sure I added android:exported to all applicable components in manifest

please help me

Solution

Update all libraries in build.gradle file if haven’t already. There’s a big chance that one of them is causing this. If this isn’t the case, you would have to manually check the Merged Manifest as mentioned by @DarShan.
It happened to me few days ago as well.

Answered By – Sujal Kumar

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published