【问题标题】:New Flutter app build fails for simulator, permission denied模拟器的新 Flutter 应用程序构建失败,权限被拒绝
【发布时间】:2020-12-26 02:22:14
【问题描述】:

当我尝试 flutter run 一个新创建的颤振应用程序时,构建失败并出现以下错误。该计算机在一年前用于 Flutter 开发,我怀疑某处存在一些不规则的配置导致此错误。这几天我一直在为此苦苦挣扎,如果有任何帮助,我将不胜感激。

复制步骤

  1. flutter create my_app
  2. cd my_app
  3. flutter run

终端输出:

app/Frameworks/App.framework/App: signed bundle with Mach-O universal
    (x86_64 arm64) [io.flutter.flutter.app]
    /Users/user/Desktop/projects/myApp/build/ios/Debug-iphonesimulator/Runner.
    app/Frameworks/Flutter.framework/Flutter: replacing existing signature
    /Users/user/Desktop/projects/myApp/build/ios/Debug-iphonesimulator/Runner.
    app/Frameworks/Flutter.framework/Flutter: Permission denied
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 11.

我试过了:

  • 卸载并重新安装 Xcode
  • 卸载并重新安装 Flutter
  • 从 Xcode 运行
  • 删除 pod/podfile 并重新安装
  • 重新启动计算机
  • flutter clean
  • 创建新应用
  • 检查是否符合所有必需的 Flutter“Get started”指令
  • 从 Xcode 运行
  • 将工作区切换到旧版构建系统
  • Locking & unlocking login in Keychain Access
  • 使用 Finder 授予项目文件夹和所有随附项目的读/写权限,并在文件上运行 chmod +x

flutter doctor -v 输出:

[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale en-GB)
    • Flutter version 1.20.3 at /usr/local/Cellar/flutter/sdk
    • Framework revision 216dee60c0 (6 days ago), 2020-09-01 12:24:47 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/user/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.7, Build version 11E801a
    • CocoaPods version 1.9.3

[!] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.48.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.14.0

[✓] Connected device (1 available)
    • iPhone 11 (mobile) • 034B59B3-8929-4997-B7A1-53E32D065347 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7 (simulator)

! Doctor found issues in 1 category.

更新I have opened an issue in the Flutter Github repo

【问题讨论】:

  • 不妨看看这个帖子:github.com/flutter/flutter/issues/50568
  • @Kris 尝试了该修复,但它并没有解决我的问题。我的错误是不同的,具体来说:Permission deniedCommand PhaseScriptExecution failed with a nonzero exit code

标签: ios xcode flutter


【解决方案1】:

通过以下步骤,我终于能够解决这个问题并在 iOS 模拟器上运行 Flutter 演示应用:

  1. flutter version v1.11.0(降级到早期版本的 Flutter)
  2. flutter channel stable
  3. flutter upgrade
  4. flutter doctor
  5. flutter create test_app
  6. cd test_app
  7. flutter run

【讨论】:

    【解决方案2】:

    基于this 问题,似乎与xcode_backend.sh 文件有关,使一些Flutter 文件只读,检查问题和this 问题,可能会帮助您解决它,祝你好运。

    【讨论】:

    • 试过这个,但它没有解决我的问题。 (该问题下的评论提到该问题已在 2019 年 12 月发布的 Flutter 版本中解决)。
    猜你喜欢
    • 2013-12-10
    • 2021-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-14
    • 2021-07-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多