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

Flutter macOS应用编译报错:找不到Release.entitlements文件求助

解决Flutter macOS应用编译时找不到Release.entitlements的错误

编译时出现以下错误:

error: Build input file cannot be found: '/Users/handikadjatidharma/honda_lucky_draw/macos/Runner/Release.entitlements'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Runner' from project 'Runner')
** BUILD FAILED **

以下是可行的解决步骤:

  • 确认文件存在并正确放置
    检查/Users/handikadjatidharma/honda_lucky_draw/macos/Runner/路径下是否存在Release.entitlements文件。如果不存在,创建该文件并填入以下内容:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>com.apple.security.app-sandbox</key>
        <true/>
    </dict>
    </plist>
    
  • 修正Xcode项目的 entitlements 路径配置
    打开项目根目录下的macos/Runner.xcodeproj,在Xcode中操作:

    1. 选中左侧导航栏的Runner目标
    2. 切换到Signing & Capabilities标签页
    3. 顶部切换到Release配置
    4. 检查Entitlements File字段的路径是否正确指向macos/Runner/Release.entitlements,若路径错误则手动修正
  • 清理缓存后重新构建
    在终端执行以下命令,清理Flutter缓存并重新构建:

    flutter clean
    flutter pub get
    flutter build macos --release
    
  • 检查文件权限
    如果文件存在但仍报错,可能是权限问题,执行以下命令赋予文件可读权限:

    chmod 644 /Users/handikadjatidharma/honda_lucky_draw/macos/Runner/Release.entitlements
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 02:32:19