Flutter - Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]

If you are getting the above error while executing the command flutter run or flutter run --release, then you can use the solutions explained below.

1 Answers

Follow the below steps to remove the error

1. Open AndroidManifest.xml file. The location of the file will be - android > app > src > main > AndroidManifest.xml.

2. Add code - android:exported="true" in like below.

<activity
    android:name=".MainActivity"
    android:exported="true"
    android:launchMode="singleTop"
    ...>

3. End

Never leave your website again in search of code snippets by installing our chrome extension.