I am getting this error while running my flutter app.The app launches on chrome but wont launch on the emulator or on a real mobile device
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install
C:\Users\HP\Desktop\OWASLO\care_giver_app\build\app\outputs\flutter-apk\app.apk:
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during
installPackageLI: /data/app/vmdl1352177004.tmp/base.apk (at Binary XML file line #53):
com.owaslo.sukithasagayo.caregiver.MainActivity: Targeting S+ (version 31 and above)
requires that an explicit value for android:exported be defined when intent filters
are present]
Error launching application on Pixel 6.
Below is my AndroidManifest file.Ive enabled multidex as well in the gradle file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.owaslo.sukithasagayo.caregiver">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="Sukitha Sagayo Member"
android:icon="@mipmap/launcher_icon">
<provider
android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
android:authorities="${applicationId}.flutter_downloader.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
below link contains my gradle file
gradle file
Please help !!!
>Solution :
add this property to <activity> as from android 12 its required to be write this for activity and your device has android api level 31 which is android – 12
android:exported="true"