iOS fastlane蒲公英自动打包(1)

想试下蒲公英自动打包,这里记录下自己安装fastlane的过程以及遇到的部分问题;

一、fastlane的配置安装

1、确认Ruby版本,终端命令行

ruby -v

2、检查xcode命令行工具是否安卓。终端输入命令行

xcode-select --install

3、使用gem进行安装

sudo gem install fastlane -NV

4、安装完成使用fastlane --version查看当前使用的版本,如下图

 

二、安装时报错处理方法

1、 mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

ERROR: Failed to build gem native extension.

解决方法:问题是Xcode 11附带了macOS 10.15 SDK,其中包含ruby2.6的标头,但不包含macOS
10.14的ruby2.3的标头。您可以通过运行来验证这是您的问题,所以重新安装xcode工具。参考网址:http://codingdict.com/questions/53234,https://www.jianshu.com/p/e13387ed93c3

(1)sudo rm -rf /Library/Developer/CommandLineTools

sudo rm -rf /Library/Developer/CommandLineTools

(2)xcode-select --install

xcode-select --install

(3)sudo xcodebuild -license accept

sudo xcodebuild -license accept

(4)open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

 

2、ERROR:  Error installing fastlane:
    There are no versions of rubyzip (< 3.0.0, >= 2.0.0) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?

解决方法:更新下载新版本的ruby,参考网址:https://www.cnblogs.com/zwting/p/11686449.html

(1)安装rvm,在命令行里执行以下步骤

curl -L get.rvm.io | bash -s stable

出现网络报错:Failed to connect to raw.githubusercontent.com port 443: Connection refused

解决方法:在本地电脑的host文件中添加网址:199.232.68.133 raw.githubusercontent.com,详细的添加方法参考https://www.jianshu.com/p/ceb571348a73

大致步骤是找到 host文件位置为:/private/etc/hosts,修改etc文件夹以及hosts文件的只读属性为可读可写,添加199.232.68.133 raw.githubusercontent.com网址;注:记得修改完权限,还原为只读权限.

(2)source ~/.rvm/scripts/rvm

source ~/.rvm/scripts/rvm

(3)echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db

echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db

(4)rvm -v

rvm -v

(5)rvm install 2.6.0

rvm install 2.6.0

至此,完成ruby版本更新;

 

3、报错:You don't have write permissions for the /usr/bin directory.

解决方法:把命令换为 sudo gem install -n /usr/local/bin fastlane –verbose

 

posted @ 2020-08-11 20:08  wusang  阅读(307)  评论(0编辑  收藏  举报