INSTALL_PARSE_FAILED_MANIFEST_MALFORMED adb ERROR while running an app in Flutter

Viewed 28

I am trying to launch an app on my Emulator (Android 12, API 31). I am receiving the following error which prevents the app from launching:

**adb: failed to install /Users/mac/Flutter_Projects/aatawala-app/build/app/outputs/flutter-apk/app.apk: Failure
[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl506413608.tmp/base.apk (at
Binary XML file line #93): io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: 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 sdk gphone64 x86 64.**

I have added the following lines in my AndroidManifest.xml file, within both the and

android:exported="true"

AndroidManifest.xml Code:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="me.attawala.customer">
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name=".Application"
        android:label="Mobile Chakki"
        android:icon="@mipmap/ic_launcher"
        android:requestLegacyExternalStorage="true">
        <meta-data android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyC1aOrNPeOgQO822khXy3yT1Gvxg0RJVmM"/>
        <activity
            android:name=".MainActivity"
            android:exported="true"
            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">
            <intent-filter android:exported="true">
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>              
            </intent-filter>
            <intent-filter android:exported="true">
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

I would like to know what exactly is causing this error and how to solve it.

1 Answers

It should be like

<activity 
    android:name="ActivityName"
    android:exported="false"/>

or

check attached screenshots(check line number 14 for more details). enter image description here

Related