【问题标题】:error: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')错误:在搜索路径中找不到包含的文件“Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig”(在目标“Runner”中)
【发布时间】:2020-01-14 00:22:14
【问题描述】:

我的颤振项目无法在 ios 设备上运行。 我在命令sudo gem install cocoapods 下尝试过。

颤动运行:

Warning: CocoaPods not installed. Skipping pod install.
  CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
  Without CocoaPods, plugins will not work on iOS or macOS.
To install:
  sudo gem install cocoapods
  pod setup



Running Xcode build...                                                  
                                                   
Xcode build done.                                            4.3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    error: /Users/sukhjinder/StudioWorkspace/shrutiFlutterProjects/myapp/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target
    Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
   
    note: Using new build systemnote: Planning buildnote: Constructing build description

Could not build the precompiled application for the device.

Error launching application on iPhone.

【问题讨论】:

  • 您是在打开 .xcproject 还是 .xcworkspace 文件??
  • .xcworkspace 文件。谢谢,但它已由我的高级开发人员解决。仍然不知道它是如何解决的。
  • 他可能更改了工作区构建设置 -> 在 Xcode 中 -> 转到文件部分 -> 工作区设置 -> 构建系统 -> 将其更改为 Legacy Build System
  • 由于flutter比较新,换成Legacy Build System意义不大。
  • 它只有在重新安装 Flutter SDK 后才对我有用

标签: ios xcode flutter dart cocoapods


【解决方案1】:

Flutter/Release.xcconfig

#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"   

#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"  

#include "Generated.xcconfig"

【讨论】:

【解决方案2】:

就我而言:

   cd /[path_to_project_directory]/ios/

然后

   pod update

修好了

【讨论】:

    【解决方案3】:

    尝试安装 pod

    cd ios
    
    pod install
    

    如果不行,就这样

    导航 ios/Podfile 文件并取消注释 platform :ios, '9.0'(remove #)

    【讨论】:

    • 在你的项目中找到ios文件夹并运行pod install
    【解决方案4】:

    我遇到了同样的问题,但没有一个给定的解决方案对我有用。

    什么对我有用:

    • 删除您的 podfile(确保备份)。
    • 现在将生成一个新的 podfile 或尝试pod init 命令。
    • 现在重新运行您的项目,它应该可以工作了。

    【讨论】:

      【解决方案5】:

      我尝试了上述所有解决方案,包括完全重新创建我的 ios 文件夹。最终起作用的是取消注释 ios/Podfile 中的 platform :ios

      # Uncomment this line to define a global platform for your project
      # platform :ios, '9.0'
      

      到这里:

      # Uncomment this line to define a global platform for your project
        platform :ios, '9.0'
      

      【讨论】:

        【解决方案6】:

        我假设您的 Flutter 项目中已经有 ios/ 文件夹。如果没有,你可以运行flutter build ios

        这个错误的根本原因大多数时候发生在你克隆了一个像 Github 这样的项目之后。

        为了修复,您需要获取软件包并安装 pod。

        flutter clean
        flutter pub get
        cd ios/
        pod install 
        

        在某些情况下,您可能需要更新您的 Pod 存储库和 Pod。您可以通过运行来做到这一点

        pod repo update
        pod update
        

        【讨论】:

          【解决方案7】:

          就我而言,我在 ios/Flutter 文件夹中添加了 2 个文件

          1 Debug.xcconfig

           #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
           #include "Generated.xcconfig"
          

          2 Release.xcconfig

            #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
            #include "Generated.xcconfig"
          

          【讨论】:

            【解决方案8】:

            100% 有效简单步骤:

            1. 打开 iso/flutter/Debug.xcconfig:1
            2. 删除下一行 #include "Pods/目标支持文件/Pods-Runner/Pods-Runner.debug.xcconfig"

            注意它应该只有这一行 #include "Generated.xcconfig"

            【讨论】:

              【解决方案9】:
              1. 打开终端,键入以下内容导航到项目:

                cd your_file_path

              2. 然后键入以下内容导航到 iOS 文件夹:

                cd ios

              3. 最后,通过键入以下内容来实现缺少的 podfile 来解决您的问题:

                pod init

              4. 然后,打开新创建的 podfile,按照文件中的说明进行操作(告诉您删除文件第二行的注释)。

              5. 关闭您的 Flutter 项目,然后重新打开它。

              6. 再次运行您的项目。

              【讨论】:

                【解决方案10】:

                打开终端,导航到项目并输入

                rm ios/Podfile
                

                然后构建项目

                flutter build ios
                

                它为我解决了问题。

                【讨论】:

                • Curios 足够了,这个解决方案对我有用,但前提是我在终端上运行 flutter run。如果我尝试使用 Android Studio(绿色箭头)运行项目,错误仍然存​​在。只是一个注释。
                【解决方案11】:

                打开“终端”并导航到您的颤振项目。 然后通过cd ios 在“ios”文件夹中导航并运行pod install

                对我来说,问题是没有安装 pod。

                【讨论】:

                  【解决方案12】:

                  我在重构项目以移动主文件夹时遇到了类似的问题。为了解决这个问题,我在 Xcode 的工作区设置中做了以下操作:

                  • 切换到Legacy Build System(由@Sumeet Jain 在 cmets 中解释)。
                  • 执行构建,它应该可以工作。
                  • 切换回New Build System (Default)
                  • 再次运行构建。

                  现在应该可以了,因为我认为它必须在工作场所设置中进行了修复。

                  仅供参考,工作区构建设置可以在 Xcode 文件菜单中找到:“文件/工作区设置”。然后在对话框中的“共享工作区”部分下查看“构建系统”下拉菜单。

                  【讨论】:

                    猜你喜欢
                    • 1970-01-01
                    • 2020-09-02
                    • 2023-03-13
                    • 2019-11-13
                    • 2021-02-24
                    • 2019-10-03
                    • 2021-05-17
                    • 2019-06-16
                    • 2021-03-10
                    相关资源
                    最近更新 更多