“无法为模拟器构建应用程序。” “在 iPhone 11 上启动应用程序时出错。”

Posted

技术标签:

【中文标题】“无法为模拟器构建应用程序。” “在 iPhone 11 上启动应用程序时出错。”【英文标题】:"Could not build the application for the simulator." "Error launching application on iPhone 11." 【发布时间】:2021-01-21 03:02:18 【问题描述】:

我需要一些帮助,不小心认为我删除了一些颤振框架,现在每次我想通过 android Studio 在 ios 模拟器上启动我的应用程序时都会收到此错误。

我已经更新了 pod,并且确实更改了 pod.lock 文件,但似乎没有任何效果。请问有人可以帮助我吗?

Xcode's output:
↳
    error: the following command failed with exit code 0 but produced no further output
    CompileC /Users/joshuachase/Library/Developer/Xcode/DerivedData/Runner-bhfxndfyr***ssfyeliwkcyzjvoz/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/image_picker.build/Objects-normal/x86_64/FLTImagePickerPlugin.o /Users/joshuachase/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+4/ios/Classes/FLTImagePickerPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
    class PictureStream with DiagnosticableMixin 
                             ^^^^^^^^^^^^^^^^^^^
    ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
    abstract class PictureStreamCompleter with DiagnosticableMixin 
                                               ^^^^^^^^^^^^^^^^^^^
    ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
    class PictureStream with DiagnosticableMixin 
          ^
    ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in.
    abstract class PictureStreamCompleter with DiagnosticableMixin 
                   ^
    ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'.
        super.debugFillProperties(properties);
              ^^^^^^^^^^^^^^^^^^^
    ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
     - 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart' ('../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
          ifPresent: _completer?.toStringShort(),
                                 ^^^^^^^^^^^^^
    ../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'.
        super.debugFillProperties(description);
              ^^^^^^^^^^^^^^^^^^^

    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.

【问题讨论】:

您是否尝试运行flutter clean 如果没有任何反应,尝试将flutter-svg版本升级到最新版本。也许这会有所帮助github.com/dnfield/flutter_svg/issues/413 这不起作用,我已经升级到最新版本。 试试flutter build ios命令,会不会报同样的错误? 完全相同的问题。 【参考方案1】:

转到设备并清除模拟器的所有设置并尝试运行 .xcworkspace 而不是 xcodeproj

【讨论】:

好的,我完成了第一步,我将如何在 Android Studio 中运行 .xcworkspace?抱歉很新

以上是关于“无法为模拟器构建应用程序。” “在 iPhone 11 上启动应用程序时出错。”的主要内容,如果未能解决你的问题,请参考以下文章

我无法解决“无法为模拟器构建应用程序。 '

无法为模拟器构建应用程序

将 cloud_firestore 添加到 pubspec Flutter 后无法为模拟器构建应用程序

在 iphone 5 和 iphone 6 中动态设置字体大小

iPhone:如何在 iPhone 中实现崩溃报告功能?

在 iPhone 上安装 iPhone 应用程序