flutter Simulator 不适用于 android 工作室,但可以通过 Xcode
flutter Simulator doesn't work on android studio but works through Xcode
这是一个奇怪的问题,当我通过 android studio 在模拟器上构建和 运行 应用程序时,出现以下错误:
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Upgrading AppFrameworkInfo.plist
Running pod install...
CocoaPods' output:
↳
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
Error output from CocoaPods:
↳
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
/Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:30:in `report'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:66:in `report_error'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `load'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `<main>'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
/Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:205:in `podfile'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:46:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `load'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `<main>'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
Error running pod install
Error launching application on iPhone SE (2nd generation).
但是当我从 Xcode 构建时,它构建得很完美。
我的问题得到了简短的解答。
在 运行 一条一条地执行以下命令后:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter pub get
cd ios
pod install
arch -x86_64 pod install (On an M1 mac use => arch -x86_64 pod install)
这里如果你得到 UTF-8 错误那么运行这个命令
export LC_ALL=en_US.UTF-8
和 运行 arch -x86_64 pod install (On an M1 mac use => arch -x86_64 pod install)
再次命令。
终于运行
flutter run
启动模拟器的命令
这是一个奇怪的问题,当我通过 android studio 在模拟器上构建和 运行 应用程序时,出现以下错误:
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode... Upgrading AppFrameworkInfo.plist Running pod install... CocoaPods' output: ↳ CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
Error output from CocoaPods:
↳
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
/Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:30:in `report'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:66:in `report_error'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `load'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `<main>'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
/Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:205:in `podfile'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:46:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `load'
from /Users/riyazatalidurrani/.rvm/rubies/ruby-2.6.6/bin/pod:23:in `<main>'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
from /Users/riyazatalidurrani/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
Error running pod install
Error launching application on iPhone SE (2nd generation).
但是当我从 Xcode 构建时,它构建得很完美。
我的问题得到了简短的解答。 在 运行 一条一条地执行以下命令后:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter pub get
cd ios
pod install
arch -x86_64 pod install (On an M1 mac use => arch -x86_64 pod install)
这里如果你得到 UTF-8 错误那么运行这个命令
export LC_ALL=en_US.UTF-8
和 运行 arch -x86_64 pod install (On an M1 mac use => arch -x86_64 pod install)
再次命令。
终于运行
flutter run
启动模拟器的命令