jenkins配置android自動打包平臺
目的
採用jenkins,關聯git,自動拉取最新程式碼,自動打包Android apk包,一方面解放開發打包慢的問題,另一方面方便測試打包迴歸,節省人力。
整個搭建過程遇到比較多小問題,後面都一一解決,本文做個記錄。
搭建流程
配置java環境
這個略過
gradle安裝
apt install gradle
下載sdkmanager
https://developer.android.com/studio/#downloads
android sdk安裝
./sdkmanager –list
android sdk安裝
./sdkmanager “platform-tools” “platforms;android-26” “build-tools;27.0.3” “ndk-bundle”
jenkins配置 ANDROID_HOME
其他部落格文章有
licences同意
安裝過程提示licenses沒有同意,找到一個解決方案。
解決方案:https://stackoverflow.com/questions/38096225/automatically-accept-all-sdk-licences
yes | sdkmanager –licenses
root@iZuf68ausnohve9zzvan1lZ:~/.jenkins/workspace/android-autobuild# ./gradlew
> Configure project :MPChartLib
File /root/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 27 in /data/android-sdk/licenses
Warning: License for package Android SDK Platform 27 not accepted.
Checking the license for package Android SDK Platform 27 in /data/android-sdk/licenses
Warning: License for package Android SDK Platform 27 not accepted.
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file '/root/.jenkins/workspace/android-autobuild/MPChartLib/build.gradle' line: 61
* What went wrong:
A problem occurred evaluating project ':MPChartLib'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /data/android-sdk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
編譯包
./gradlew tasks
./gradlew assembleDebug
編譯測試包
./gradlew assembleDebug –stacktrace
版本號自動遞增
每次自動打包,版本號自動遞增,實現:
http://devdeeds.com/auto-increment-build-number-using-gradle-in-android/
相關文章
- 使用Jenkins自動構建Android應用打包並上傳JenkinsAndroid
- Mac 環境下 Android 使用 Jenkins 構建自動化打包MacAndroidJenkins
- Android:平臺自動設定Pinctrl的預設配置Android
- 這應該是最全的Jenkins Android自動打包構建教程JenkinsAndroid
- Jenkins自動部署配置Jenkins
- jenkins+gitlab + 蒲公英實現 android 應用自動化打包分發JenkinsGitlabAndroid
- 關於jenkins自動化打包探索Jenkins
- android使用jenkins進行自動化打包並且上傳到fir或者蒲公英AndroidJenkins
- jenkins+git+maven+tomcat 實現自動打包部署JenkinsGitMavenTomcat
- 前端使用docker+jenkins實現自動打包部署前端DockerJenkins
- jenkins流水線自動構建配置Jenkins
- 解放雙手 | Jenkins + gitlab + maven 自動打包部署專案JenkinsGitlabMaven
- Jenkins + Git + fastlane + 蒲公英實現自動化打包上傳JenkinsGitAST
- 使用Jenkins實現前端自動化打包部署(Linux版本)Jenkins前端Linux
- 阿里雲伺服器配置Jenkins自動打包部署vue專案(新手攻略第二彈)阿里伺服器JenkinsVue
- 開普勒雲平臺:如何配置gitlab與JenkinsGitlabJenkins
- Jenkins + GitLab + Xcode + Fir 實現iOS自動打包和分發JenkinsGitlabXCodeiOS
- Android 多渠道打包配置Android
- Android Jenkins引數化配置AndroidJenkins
- JB的測試之旅-利用jenkins達到提tag自動打包Jenkins
- Jenkins+Fastlane+自動化打包釋出+蒲公英二維碼展示JenkinsAST
- Centos 下安裝 Android SDK 供 Jenkins 打包使用CentOSAndroidJenkins
- jenkins 配置為node程序不在時,自動連jenkins master伺服器JenkinsAST伺服器
- jenkins的安裝和配置(flask結合jenkins半自動化部署流程)JenkinsFlask
- Flutter Jenkins打包FlutterJenkins
- 使用 Fastlane 實現 iOS 跟 Android 自動打包指令碼ASTiOSAndroid指令碼
- 直播電商平臺開發,Android | 圖片縮放、自動居中Android
- 自動化測試平臺
- Jenkins+Git+Walle+AndResGuard打造Android多渠道打包系統JenkinsGitAndroid
- Android持續整合:Jenkins+Gradle+360加固+多渠道打包AndroidJenkinsGradle
- jenkins 自動化流程Jenkins
- Carla 自動駕駛模擬平臺的安裝與配置指南自動駕駛
- Jenkins Android APP 持續整合體系建設二—自動部署、執行測試任務,關聯打包任務JenkinsAndroidAPP
- Android打包之配置構建變體Android
- UI 自動化測試平臺UI
- Jenkins + GitHub 自動構建JenkinsGithub
- Jenkins自動部署spring bootJenkinsSpring Boot
- Django 介面自動化測試平臺Django