简体   繁体   中英

Flutter iOS build fails randomly

I keep facing intermittent build failures for the ios build of my Flutter project. Android is working fine. 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. 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):

UPDATE MAY 14th:

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:

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 ). It's because the property FLUTTER_APPLICATION_PATH isn't defined.

I see this property in ios/Flutter/Generated.xcconfig, so I don't know where else it should be defined. Any ideas?

It seems like the error could be related to flutterToast. Have you tried removing it from you pubsec.yaml and your code and see if it alleviates the issues you see. 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. Most times the error messages are more descriptive that way. Good luck!

Look like is flutter 1.17 problems. Hope that can fix the problem in next dependencies update.

Same situation with ur problems. 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. 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. The main error is the one regarding missing main method. 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.

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. Try to add main.dart with main method there.

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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