【问题标题】:How to resolve an error: The sandbox is not in sync with the Podfile.lock如何解决错误:沙箱与 Podfile.lock 不同步
【发布时间】:2020-11-23 08:53:33
【问题描述】:

当我在 Flutter 中添加新插件时,我的运行器 xcode 中出现此错误:

沙盒与 Podfile.lock 不同步。运行“pod install”或更新您的 CocoaPods 安装

我已经安装并更新了 CocoaPods。我尝试运行 pod install 并没有修复它,请帮助

【问题讨论】:

    标签: flutter cocoapods flutter-ios podfile-lock


    【解决方案1】:

    在我的情况下,问题是由本地 android 插件引起的。我为插件创建了一个虚拟 podsec 文件,然后运行:

    cd ios
    flutter pub get
    pod install
    pod update
    

    现在似乎我需要在每个 xcode 项目清理后执行这些步骤。

    $ flutter doctor
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.6 19G73, locale en-AU)
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    [✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    [✓] Android Studio (version 4.0)
    

    【讨论】:

    • @MebroukiAmine 您是否从 pod install 中得到任何错误?尝试先删除 pods 文件夹。
    • 只是运行 cd ios flutter pub get pod install pod update 为我修复了它
    【解决方案2】:

    在我的情况下,我已经清理了构建,然后更新了 pod 文件,但是有一些警告但可以忽略:

    > flutter clean
    > flutter pub get
    > cd ios
    > pod update
    

    【讨论】:

      【解决方案3】:

      如果 M1 Mac 上的任何人遇到此问题并在运行 pod update 时遇到错误,对我而言,修复不是从 VS Code 运行该命令,而是在将其设置为 Open using Rosetta 后在默认终端中运行。

      之后它正确更新,我可以构建我的应用程序。

      【讨论】:

        【解决方案4】:

        尝试运行以下命令

        1. 扑干净
        2. rm Podfile.lock
        3. rm -rf Pods/
        4. cd ios
        5. pod install
        6. pod update
        7. flutter run(或flutter build ios)

        仍然遇到同样的错误,然后将以下设置添加到用户定义的设置

        PODS_ROOT = ${SRCROOT}/Pods
        PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 
        

        然后运行flutter run(或flutter build ios

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-02-17
          • 2019-04-11
          • 2021-06-16
          • 1970-01-01
          • 1970-01-01
          • 2015-10-25
          • 2019-07-17
          • 2013-10-02
          相关资源
          最近更新 更多