Jenkins集成的問題

總結一些配置Jenkins的坑

如何配置Jenkins可以看我上一篇http://www.lxweimin.com/p/c7b951b9b4f2

首先到輸出日志里面,commmand+f搜索error或者fail,可以看到那里構建出錯了。基本都是在日志的最后面。

1.構建的工程路徑出錯

.xcodebuild: error: '.XXXXXX.xcworkspace' does not exist.

解決方法當然是到配置里面,改好正確的路徑啦,記得路徑后面不要帶.xcworkspace

WechatIMG1.jpeg

2.構建targets路徑出錯

xcodebuild: error: You cannot specify targets with a workspace.
xcodebuild: error: If you specify a workspace then you must also specify a scheme.  Use -list to see the schemes in this workspace.

解決方案看圖

WechatIMG2.jpeg
WechatIMG3.jpeg
WechatIMG5.jpeg

3.找不到schemes的錯誤

There are no schemes in workspace "XXX".

選擇manage schemes,然后把里面schemes的show和share都勾上,關閉提交代碼。


WechatIMG6.jpeg
WechatIMG7.jpeg

4.創建輸出路徑出錯

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't create output file: /Users/yuandiLiao/Desktop/ipa/libFMDB.a (Permission denied)

出現這個問題是我配置的時候.ipa輸出路徑是在桌面創建了文件夾,但是每次構建都失敗,最后我只能是輸出在工作區了。
輸出Build output directory和Output directory還是都填 ${WORKSPACE}/build/ 吧。

5.證書沒導入導致xcode找不到配置文件

No profiles for 'XXXX' were found:  Xcode couldn't find a provisioning profile matching 'XXXX'.
Code signing is required for product type 'Application' in SDK 'iOS 10.2'


No profile matching 'XXXXX' found:  Xcode couldn't find a profile matching 'XXXXX'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor.
Code signing is required for product type 'Application' in SDK 'iOS 10.2'

這個問題很坑,在這里搞了挺久的,因為沒有~/Library/MobileDevice/的整個文件夾Provisioning Profiles拷貝到/Users/Shared/Jenkins/Library/MobileDevice下面(沒有MobileDevice文件夾就創建一個)。
論壇也有大神說是因為xcode8自動管理證書的問題,用shell命令解決的,具體的可以去搜搜看,但是我用的也是xcode8,配置好證書后就沒有這個問題了。具體的可以看我上一篇博客

6. pod: command not found

使用cocoapods管理工程,需要執行pod install 時可能會出現這個錯誤。打開終端輸入 $PATH 注意這個path要大寫,如下得到path,然后打開Jenkins ->系統管理->系統設置->全局屬性->Environment variables -> 鍵值對列表中設置


WechatIMG19.jpeg
WechatIMG20.jpeg

7. Unable to find a specification for 執行cocoapods時找不到庫文件

首先cd到項目目錄先,然后執行以下兩個命令,把目錄clear以下就行了

pod repo remove master  
pod setup 

8.安裝fir-cli出錯,沒有權限

gem install fir-cli

直接執行安裝的話會被拒絕

sudo gem install fir-cli

在前面加上sudo,然后會需要輸入密碼安裝
有可能還會報以下問題

ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/restclient

權限被拒絕

解決方案一

sudo gem install -n /usr/local/bin fir-cli --no-ri --no-rdoc

解決方案二,執行以下兩個命令,安裝Homebrew 和ruby,

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ruby

最后安裝fir-cli應該就可以了

sudo gem install fir-cli

安裝成功后可是登陸

fir login

上傳

fir publish /Users/liaoyuandi/Desktop/zhiboji.ipa 

9分享一個shell命令打包需要的plist文件,

(鏈接: https://pan.baidu.com/s/1bIaZYu 密碼: 7knj)

10.上傳fir時遇到的問題 Can not found mapping or dysm file in

found remote files : **/mapping.txt found remote files :
/var/lib/jenkins/workspace/testandroid ERROR: Can not found
mapping or dysm file in /var/lib/jenkins/workspace/testandroid.
Deployment failed : Error while get details for update id
com.zftlive.android Build step 'Upload to fir.im' marked build as
failure

這個問題是fir的新版插件的問題,本來是默認不用上傳dysm file文件的,但是新版fir插件應該是默認了要上傳,所以導致了找不到這個文件報錯。換回之前舊版本的fir插件就行了,分享一個舊版本的fir插件地址吧(鏈接: https://pan.baidu.com/s/1bptne39 密碼: 6xsy)

11. The SDK directory '/Users/liaoyuandi/Library/Android/sdk' does not exist.

用Jenkins打包安卓時,可能會報SDK找不到。

1.檢查你的 系統管理-> 系統設置 ->全局屬性里面的鍵值對
件的名稱一定是要ANDROID_HOME ,值是你的android SDK的絕對路徑是否配置了。如果已經配置好了還是報這個問題的話,需要對該路徑chmod一下

2.對android sdk路勁執行

chmod -R 777 +路徑
或者(可能沒有權限)
sudo chmod -R 777 +路徑

如果還不行就對SDK的上級目錄執行,一直chmod上去就可以了

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容