简体   繁体   English

Flutter iOS 构建随机失败

[英]Flutter iOS build fails randomly

I keep facing intermittent build failures for the ios build of my Flutter project.对于我的 Flutter 项目的 ios 构建,我一直面临间歇性构建失败。 Android is working fine. Android 工作正常。 Every few days this happens, and then I do a combination of deleting my Pods folder and Podfile.lock file, pod cache clean --all , and running pod install , and the errors magically go away.每隔几天就会发生这种情况,然后我会删除我的Pods文件夹和Podfile.lock文件、 pod cache clean --all和运行pod install ,然后错误地神奇地 go 消失。 This time however, nothing seems to be working and I keep getting the errors.但是,这一次似乎没有任何效果,并且我不断收到错误消息。

I am completely stuck and would really appreciate any help from my fellow developers.我完全被困住了,非常感谢我的开发人员提供的任何帮助。 Here is the log I get when trying to run on iOS simulator (the weird part is that the errors are always different on every build):这是我尝试在 iOS 模拟器上运行时得到的日志(奇怪的是,每次构建的错误总是不同的):

UPDATE MAY 14th: 5月14日更新:

So after doing a number of things, I am now getting another error.因此,在做了很多事情之后,我现在又遇到了另一个错误。 I did a flutter run --verbose and in the logs I noticed this:我做了一个flutter run --verbose并且在日志中我注意到了这一点:

The path does not exist
Command PhaseScriptExecution failed with a nonzero exit code

After some more digging I realized it's coming from xcode_backend.sh (in the Flutter/packages/flutter_tools/bin/directory ).经过一番挖掘后,我意识到它来自xcode_backend.sh (在Flutter/packages/flutter_tools/bin/directory中)。 It's because the property FLUTTER_APPLICATION_PATH isn't defined.这是因为属性 FLUTTER_APPLICATION_PATH 没有定义。

I see this property in ios/Flutter/Generated.xcconfig, so I don't know where else it should be defined.我在 ios/Flutter/Generated.xcconfig 中看到了这个属性,所以我不知道应该在哪里定义它。 Any ideas?有任何想法吗?

It seems like the error could be related to flutterToast.似乎该错误可能与flutterToast有关。 Have you tried removing it from you pubsec.yaml and your code and see if it alleviates the issues you see.您是否尝试过从您的 pubsec.yaml 和您的代码中删除它,看看它是否能缓解您看到的问题。 Another go to I usually do when facing similar iOS/pod issues is I run pod install from the terminal in the iOS folder then try to build from Xcode.另一个 go 在遇到类似的 iOS/pod 问题时我通常会做的是,我从 iOS 文件夹中的终端运行 pod install 然后尝试从 Xcode 构建。 Most times the error messages are more descriptive that way.大多数时候,错误消息更具描述性。 Good luck!祝你好运!

Look like is flutter 1.17 problems.看起来像是 flutter 1.17 的问题。 Hope that can fix the problem in next dependencies update.希望能在下一次依赖更新中解决这个问题。

Same situation with ur problems.与您的问题相同的情况。 https://github.com/FirebaseExtended/flutterfire/issues/2530 https://github.com/FirebaseExtended/flutterfire/issues/2530

From the log I see it looks like one of the libraries you use, uses deprecated or/and unused language or native library API.从日志中我看到它看起来像您使用的库之一,使用已弃用或/和未使用的语言或本机库 API。 I would try to remove ^ symbol from your yaml file and downgrade to the latest stable version or update to the newest your libraries - it may help you to get rig of warnings.我会尝试从您的yaml文件中删除^符号并降级到最新的稳定版本或更新到最新的库 - 它可能会帮助您获得警告。 The main error is the one regarding missing main method.主要错误是关于缺少main方法的错误。 Build fails because of that.因此构建失败。 Builds don't fail due to the warnings but only dou to the errors.构建不会因警告而失败,而只会因错误而失败。 And the only error Ctrl-F finds in your log - the Error: Error when reading 'lib/main.dart': No such file or directory package:myProject/main.dart: Error: No 'main' method found. Ctrl-F 在您的日志中发现的唯一错误 - 错误:读取“lib/main.dart”时出错:没有此类文件或目录 package:myProject/main.dart:错误:未找到“主”方法。

I know you said that you supply other file but flutter plugin may not be as stable as you think so it may just confuse it.我知道你说你提供了其他文件,但是 flutter 插件可能不像你想象的那么稳定,所以它可能会混淆它。 Try to add main.dart with main method there.尝试在那里添加 main.dart 与main方法。

Hope it helps.希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM