【问题标题】:build failed after flutter upgrade颤振升级后构建失败
【发布时间】:2021-11-01 08:39:09
【问题描述】:

升级flutter出现异常,应用无法再次运行如何解决?

In file included from
    /Users/raitotec/developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.m:5:
    /Users/raitotec/developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.h:5:9
    : fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~


flutter doctor -v


[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-SA)
    • Flutter version 1.22.5 at /Users/raitotec/developer/flutter
    • Framework revision 7891006299 (9 months ago), 2020-12-10 11:54:40 -0800
    • Engine revision ae90085a84
    • Dart version 2.10.4

  [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/raitotec/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 12.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.0

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (1 available)
    • iPhone 12 mini (mobile) • A9648508-3B05-4468-B593-477288FC7370 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)

【问题讨论】:

    标签: ios flutter flutter-dependencies


    【解决方案1】:

    有类似的问题。 在pub upgrade 之后,(长话短说)该应用无法像以前那样运行。

    pubspec.yaml 文件包含应用程序使用的依赖项(包),通常是添加包的最低版本。 pubspec.lock 文件包含应用程序的所有依赖项(包),以及每个依赖项的确切版本。

    当您运行 pub upgrade 时,它会获取所有依赖项的最新版本并更新 pubspec.lock, 例如,pubspec.yaml 中的依赖项可能声明版本 1.0,在 pub upgrade 之后使用的版本可以是 1.1(在 pubspec.lock 中) 尽管此文件不应包含在提交中,但如果您可以访问它的先前版本,则可以将其与 pub upgrade` 之后的版本进行比较,并在需要时将其还原。

    降级一个依赖解决了我的问题。

    【讨论】:

      【解决方案2】:

      尝试flutter clean 然后flutter pub upgrade

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-05
      • 2021-06-06
      • 1970-01-01
      • 2020-12-14
      • 2020-01-14
      • 2022-01-01
      相关资源
      最近更新 更多