Flutter-flutter run报错Could not build the application for the simulator.
Posted MinggeQingchun
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flutter-flutter run报错Could not build the application for the simulator.相关的知识,希望对你有一定的参考价值。
今天启动了一下flutter项目,执行
运行了一下flutter项目
flutter run
报错如下:
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
最开始是直接先执行flutter clean 命令,然后再运行,发现还是报错
flutter clean
仔细看了一下报错信息,发现是ios文件下Podfile中某个库没拉下来,导致找不到头文件,于是执行下面命令,还是不行
flutter clean
cd ios
pod update Firebase/Firestore
最后在Stack Overflow上找到一个答案,解决掉了
原文如下:
This error can occur due to multiple reasons.
Firstly, it can occur due to some native error which can be found by building the app in Xcode using ⌘ + B. If that's the case then you can solve the error and try building the app in the Xcode itself. If it succeeds in the building process then your app will run from Simulator.
Secondly, try to change the iOS version from Xcode if not done already.
Thirdly, it can occur due to some changes in the pods. To fix this follow the following steps:
rm ios/Podfile
flutter pub get to get packages.
Remove Pods folder from the ios folder in the directory.
cd ios then pod install
flutter clean
Run the project. ( Press F5 if you are using VSCode )
I hope this solves your issue.
但是博主执行命令如下:
1、flutter pub get
2、将Pods文件夹在ios文件夹下移除(Remove Pods folder from the ios folder in the directory.)
3、cd ios
4、pod install
5、flutter clean
6、flutter run
我并没有执行 rm ios/Podfile 命令,不然执行 pod install 命令时会导致报错:找不到Podfile文件
具体参考:
以上是关于Flutter-flutter run报错Could not build the application for the simulator.的主要内容,如果未能解决你的问题,请参考以下文章
项目报错A complete log of this run can be found in:...
IDEA配置Tomcat报错Error running Tomcat9.0怎么解决?
webpack run build 报错:ERROR in static/js/vendor.js from UglifyJs