笔记笔记
  • Home
  • AI&ML
  • Example
  • Zoo
  • 关于
⌘ K
Flutter
最后更新时间:
Copyright © 2023-2024 | Powered by dumi | GuoDapeng | 冀ICP备20004032号-1 | 冀公网安备 冀公网安备 13024002000293号

TABLE OF CONTENTS

‌
‌
‌
‌

Flutter

Mac - Apple Silicon 环境

下载 Apple Silicon 的安装包,解压。 下载 Flutter

建议自己安装 Ruby。因为我遇到了很多下面类似的错误。

ERROR: Error installing cocoapods:
The last version of drb (>= 0) to support your Ruby & RubyGems was 2.0.6. Try installing it with `gem install drb -v 2.0.6` and then running the current command again
drb requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.
# 安装 Ruby
brew install ruby
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin23]
# 设置 gem 源
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
# 查看 gem 源
gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.com/

安装 CocoaPods

# 安装 CocoaPods
gem install cocoapods -V
# 查看版本
pod --version
1.15.2

添加如下配置:

vi ~/.zshrc
export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"
export PATH=$HOME/Documents/env/flutter/bin:$PATH
export CHROME_EXECUTABLE="/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev"
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export PATH="$HOMEBREW_PREFIX/lib/ruby/gems/3.3.0/bin:$PATH"

常见问题

遇到如下错误:

Exception in thread "main" java.util.zip.ZipException: zip END header not found

清除 ~/.gradle 文件夹即可重新下载包。

cd ~
rm -R .gradle
Preview