flutter运行常见问题

1、当误删某个flutter操作文件时,运行报错如下
The 'Pods-Runner' target has transitive dependencies that include
statically linked binaries:
(/Users/me/works/flutter_app/test_app/ios/Flutter/Flut
ter.framework)
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/
target_validator.rb:84:in block (2 levels) in verify_no_static_framework_transitive_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/ target_validator.rb:74:ineach_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/
target_validator.rb:74:in block in verify_no_static_framework_transitive_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/ target_validator.rb:73:ineach'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/
target_validator.rb:73:in
verify_no_static_framework_transitive_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/ target_validator.rb:38:invalidate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:590
:in validate_targets' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:158 :ininstall!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.
rb:52:in run' /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:inrun'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in
run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in (required)>'
/usr/local/bin/pod:23:in load' /usr/local/bin/pod:23:in

从网上搜了各种解决方法试了之后都不行,最终通过重新安装cocoapods
安装步骤:
1.执行:which pod
作用:找出目前版本的pod路径
2.rm -rf /usr/local/bin/pod
作用:其中/usr/local/bin/pod为上一步骤返回的路径值
3.sudo gem install cocoapods
作用:重新下载安装cocoapods

2、苹果机安装报detached HEAD!
WechatIMG3.jpeg
解决方法:
执行如下命令
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec

然后重新flutter run就可以啦

你可能感兴趣的:(flutter运行常见问题)