You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

小米M2007J3SG手机ADB安装APK失败(退出码1)问题求助

解决ADB安装失败:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED错误

这个问题我帮不少开发者处理过,核心原因很明确:你的应用targetSdkVersion >= 31(Android 12+),而作为启动页的MainActivity声明了intent filters(比如那个LAUNCHER过滤器),但没有显式设置android:exported属性——这是Android 12开始的强制要求,系统会拒绝安装不符合这个规范的APK。

咱们一步步来修复:

  1. 找到你的Flutter项目里的Android清单文件,路径是 android/app/src/main/AndroidManifest.xml
  2. 定位到MainActivity的标签,你会看到类似这样的代码:
<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">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>
  1. 给这个activity标签添加android:exported="true"属性(因为启动页需要被系统外部调用,所以设为true),修改后代码如下:
<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>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>
  1. 保存文件后,重新运行你的应用(可以执行flutter run命令),这个安装错误应该就消失了。

额外注意事项

  • 不只是MainActivity,如果你的应用里还有其他Activity、Service或者Broadcast Receiver声明了intent filters,并且targetSdkVersion >=31,都需要显式设置android:exported属性:如果组件需要被外部应用或系统调用,设为true;如果只是内部使用,设为false。
  • 你提到问题是最近更新后出现的,应该是更新时把targetSdkVersion升级到了31+,触发了这个Android平台的新规范检查。

内容的提问来源于stack exchange,提问作者Muhammad Faruq

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 23:49:05