flutter命令
如何打开一个ios模拟器
open -a Simulator
运行
flutter run
空安全运行
flutter run --no-sound-null-safety
目录
flutter命令
问题:
1.Error: Cannot run with sound null safety, because the following dependencies don't support null safety:
2.使用了webview_flutter后flutter? run出现问题:warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET'? ? is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')
问题:
1.Error: Cannot run with sound null safety, because the following dependencies don't support null safety:
run:
flutter run --no-sound-null-safety
build:
flutter build apk --no-sound-null-safety
2.使用了webview_flutter后flutter? run出现问题:warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' ? ? is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')
在flutter项目的ios目录下找到Podfile文件,在底部替换post_install.....的内容为
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
然后cd到ios目录下,执行Pod install,然后出现提示信息
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
解决第一个!问题。打开PodFile,释放注释platform :ios, '9.0'
解决第二个!问题。打开Flutter/Release.xcconfig ,添加
#include "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
然后再次运行pod install
之后还是出错,然后发现dart SDK版本号太低了,我的升级方式最终是下载新版本的flutter替换老版本文件夹。
|