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

运行Flutter应用时遇Gradle构建失败:firebase_core清单解析异常

Flutter构建失败:firebase_core的AndroidManifest.xml格式错误

运行Flutter应用时遭遇Gradle构建失败,具体错误如下:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':firebase_core:processDebugManifest'.

org.xml.sax.SAXParseException; systemId: file:/Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.17.1/android/src/main/AndroidManifest.xml; lineNumber: 11; columnNumber: 12; Content is not allowed in trailing section.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 23s
Exception: Gradle task assembleDebug failed with exit code 1

错误源于firebase_core-1.17.1的AndroidManifest.xml文件格式异常,根标签</manifest>尾部存在多余内容。以下是解决步骤:

  • 修复AndroidManifest.xml文件
    找到路径/Users/user/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.17.1/android/src/main/AndroidManifest.xml,打开后检查第11行附近,删除</manifest>标签之后的所有多余字符、空格或代码,确保文件以该标签结尾且无后续内容。

  • 清理缓存并重新获取依赖
    执行命令:

    flutter clean
    flutter pub get
    
  • 升级firebase_core版本
    在项目的pubspec.yaml中,将firebase_core的版本替换为最新稳定版(例如firebase_core: ^2.15.0),然后执行flutter pub get拉取新依赖。

  • 重新构建项目
    执行flutter run重新运行应用,验证问题是否解决。

内容的提问来源于stack exchange,提问作者Lets Done This

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.20 09:30:51