Search code examples
androidreact-nativeandroid-studiobuild.gradleandroid-manifest

ERROR : The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED ( React-Native-Android-Studio )


05/23 16:24:51: Launching 'app' on realme.
Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

List of apks:
[0] 'E:\New folder\MyPlayer\android\app\build\outputs\apk\debug\app-debug.apk'
Installation failed due to: 'Failed to commit install session 1629738225 with command package install-commit 1629738225. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1629738225.tmp/base.apk (at Binary XML file line #75): androidx.media.session.MediaButtonReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'
Retry
Failed to launch an application on all devices

I am Working on React Native App and When am trying to run app by Android studio facing this issue and also tried everything still facing this issue INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

This is my AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.myplayer">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.android.vending.BILLING" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true"
        >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

Solution

  • androidx.media.session.MediaButtonReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present

    This line is mentioned in error and as per that , you need to either update lib which is using androidx.media.session.MediaButtonReceiver or you can add this line in your AndroidManifest.xml file under <application> tag as targeting S+ need to mention android:exported for each activity , receiver and service

    <receiver android:name="androidx.media.session.MediaButtonReceiver" android:exported="true">
      <intent-filter>
        <action android:name="android.intent.action.MEDIA_BUTTON" />
      </intent-filter>
    </receiver>