求助:模拟应用时反复出现install_parse_failed_manifest_malformed错误
install_parse_failed_manifest_malformed After Fixing Package Name Case Hey there, let's tackle this stubborn install_parse_failed_manifest_malformed error you're facing—fixing the package name to lowercase was a good first step, but there are plenty of other Manifest issues that can trigger this error. Let's break down the most likely culprits and how to fix them:
Common Causes & Fixes
1. Incomplete or Malformed Manifest Tags
Your provided code snippet cuts off mid-android:roundIcon attribute, which is a red flag. Manifest files require all tags to be properly closed and attributes to have complete values. For example:
- Ensure the
roundIconresource reference is fully written (e.g.,@mipmap/ic_launcher_roundinstead of@mipmap/ic_launch...) - Double-check that the
<application>tag has a corresponding</application>closing tag, and the root<manifest>tag is properly closed at the end of the file.
2. Invalid Attribute Values or Typos
Even small typos can break Manifest parsing:
- Verify attribute names are correctly cased (e.g.,
android:allowBackupnotandroid:allowBackUp—Android is case-sensitive here) - Ensure resource references like
@string/app_nameexist in yourstrings.xmlfile, and@mipmap/ic_launcherhas matching drawable resources in your project.
3. Missing Required Attributes (Android 12+)
If your app targets Android 12 (API level 31) or higher, components like <activity>, <service>, and <receiver> must include the android:exported attribute (set to true or false). Omitting this will trigger a parse failure. Example:
<activity android:name=".MainActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
4. Invalid SDK Version Declarations
Check that minSdkVersion, targetSdkVersion, and compileSdkVersion (in your build.gradle file) are valid integers, not strings or invalid values. For example, avoid wrapping version numbers in quotes like "23"—use 23 instead.
Debugging Tools to Pinpoint the Issue
- Android Studio Manifest Editor: Open your
AndroidManifest.xmlin Android Studio—it will highlight syntax errors with red underlines and provide quick fixes. - AAPT Command: Run this command in your terminal to get detailed parse error messages:
This will show exactly where the Manifest parsing failed, which is often more specific than the generic error message you're seeing.aapt dump badging path/to/your/app.apk
Start by fixing the truncated roundIcon attribute and ensuring all tags are closed—those are the most obvious issues in your snippet. If that doesn't work, use the AAPT command to get precise error details.
内容的提问来源于stack exchange,提问作者Karl

