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

我正在开发 react native 应用程序,当我try 运行Android Studio 的应用程序时遇到这个问题,也try 了所有仍然面临这个问题的方法INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

这是我的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>

推荐答案

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

错误地提到了这一行,因此,您需要更新使用androidx.media.session.MediaButtonReceiver的lib,或者您可以在AndroidManifest.xml文件中的<application>标记下添加此行作为目标S+需要 for each 活动、接收方和服务提到android:exported

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

Android相关问答推荐

致命信号6(SIGABRT)MAUI应用程序在android net发布时崩溃.8、使用强制屏幕方向和并发GC

如何在Jetpack Compose中使用Box Composable来实现这种布局?

推断的类型是片段,但应为上下文

安卓Gradle看不到dagger 柄

无法加载类';com.android.build.api.extension.AndroidComponentsExtension';

Jetpack Compose:带芯片的Textfield

由于Xcode运行脚本阶段没有指定输出,在IOS Emulator中的KMM项目中生成失败

Jetpack Compose X.dp 性能问题?

使用lazyColumn迁移paging3的旧代码

是否可以在 compose 中使用三次贝塞尔曲线进行动画?

SQLite Kotlin 问题 - 没有数据库

Android 应用程序从 Android Studio 安装,但不是作为 .apk 在外部安装.抛出java.lang.UnsatisfiedLinkError

为一组闪烁的可组合项制作动画,控制同步/定时

Android Studio XML 文本在 ConstraintLayout 中不居中

如何添加到先前预填充的 Room 数据库?

Jetpack Compose 部分或开放侧边框

如何在 Jetpack Compose 中设置行宽等于 TextField 的宽度?

如何为具有不同屏幕尺寸但相同密度的手机创建响应式布局?

Google Play 控制台您的应用是否使用广告 ID?

在 jetpack compose 中使用 .shadow 和 Button 会导致问题