我不知道为什么,但我不能在我的新Macbook上构建或运行这款应用程序,我在另一台Mac或我的Windows电脑上运行相同的文件夹,运行得很好. 在这里,当我清清楚楚地运行Flutter 克时,我必须运行pub get来解决问题,这正常吗?

如果我创建一个新的项目,我可以正常地运行Flutter 运行,所以我想也许在那里 我认为这可能与插件有关.

你知道我怎么才能解决这个问题吗?谢谢

Flutter Doctor
[✓] Flutter (Channel master, 1.24.0-8.0.pre.343, on macOS 11.0.1 20B29 darwin-x64, locale es-419)
    • Flutter version 1.24.0-8.0.pre.343 at /Users/leo/tools/flutter
    • Framework revision cf6c33e58a (2 days ago), 2020-11-21 14:04:01 -0800
    • Engine revision 23a8e027db
    • Dart version 2.12.0 (build 2.12.0-62.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/leo/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-6915495)
    • All Android licenses accepted.

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

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      ? https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      ? https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (2 available)
    • sdk gphone x86 arm (mobile) • emulator-5554                        • android-x86 • Android 11 (API
      30) (emulator)
    • iPhone 12 Pro Max (mobile)  • F768139D-7B87-4D9E-93B8-14C7D63786B0 • ios         •
      com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)

• No issues found!




Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...                                                  
Xcode build done.                                           11.4s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    <module-includes>:1:9: note: in file included from <module-includes>:1:
    #import "Headers/vibration-umbrella.h"
            ^
    /Users/leo/Apps/previate_esta/ios/Pods/Target Support Files/vibration/vibration-umbrella.h:13:9: note:
    in file included from /Users/leo/Apps/previate_esta/ios/Pods/Target Support
    Files/vibration/vibration-umbrella.h:13:
    #import "VibrationPlugin.h"
            ^
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/vibration-1.4.0/ios/Classes/VibrationPlugin.h:1:9: error:
    'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^
    <unknown>:0: error: could not build Objective-C module 'vibration'
    In file included from
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.m:7:
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.h:5:9
    : fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference
    sPlugin.m:5:
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference
    sPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.m:5:
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.h:5:9: fatal
    error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.m:5:
    /Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.h:5:9: fatal
    error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    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 12 Pro Max.

推荐答案

我找到了一个解决方案!

  1. 备份ios/Runner文件夹.

  2. 删除ios文件夹.

  3. flutter create (your project name)英里.在您拥有项目的前一个文件夹中(cd users/user/"projects_folder") (这将重新创建您的ios文件夹).

  4. 将Runner备份粘贴到ios文件夹中(粘贴到项目中).

  5. 打开Runner.xcworkspace(进入ios文件夹),在那里,判断版本,Bundle ID,所有的信息.

  6. (如果你有Firebase,你必须将Google Service-Info.Plist复制并粘贴到Runner文件夹中(总是通过Xcode)(如果你手动操作,它不起作用).

最后,flutter run个个,应该行得通!

如果flutter run个失败:

  1. cd ios
  2. pod install
  3. cd ..
  4. flutter run

Ios相关问答推荐

Xcode15.3上的生成错误:调用的对象类型';facebook::flipper::SocketCertificateProvider';不是函数或函数指针

带有故事板的Xcode 15 UIKit视图可以与#Preview宏一起使用吗?

在flutter中使用flatter_screenutil这样的软件包的目的是什么?

SwiftUI:.toolbar 不适用于 UITextView

将 Riverpod 从 StateNotifier 修复为 NotifierProvider 以及应用程序生命周期监控

比较 `某个协议` 实例时出现编译错误

iOS应用启动时崩溃问题解决方法-NO_CRASH_STACK-DYLD 4个符号丢失

如何解决错误 HE0004:无法在 Visual Studio 2022 中加载框架ContentDeliveryServices

ITMS-90725 无用的错误信息,因为它自相矛盾,苹果上传

在标签中显示多个计数器但在同一屏幕(Swift,IOS)

JSONDecoder 在模拟器上运行良好时无法在真实设备上解码

SensorKit - 获取数据不调用结果委托函数

如何避免任何绑定空错误并更好地获取代码

如何使用 swift 显示 .svg 图像

iPhone iOS 无法正确显示 box-shadow

如何关闭情节提要弹出框

如何在 OS X 或 iOS(不使用格式塔)中确定运行时的操作系统版本?

直接下载Xcode模拟器

如何在react 导航中获取当前路由名称?

如何动态计算 UILabel 高度?