第一、需求描述
1、配置专门编译服务器,方便打包
2、配置定时编译及渠道参数,方便以后自动化控制编译
第二、运行环境
操作系统:Ubuntu 16.04
python@iZuf6bkt7m4txqajvno52yZ:~$ cat /etc/issue
Ubuntu 16.04.6 LTS \n \l
软件包
#Java版本:1.8.0_19
python@iZuf6bkt7m4txqajvno52yZ:~$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
#git版本:1.8.0_19
python@iZuf6bkt7m4txqajvno52yZ:~$ git --version
git version 2.7.4
#gradle版本:4.4
python@iZuf6bkt7m4txqajvno52yZ:~$ gradle --version
------------------------------------------------------------
Gradle 4.4
------------------------------------------------------------
Build time: 2017-12-06 09:05:06 UTC
Revision: cf7821a6f79f8e2a598df21780e3ff7ce8db2b82
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_191 (Oracle Corporation 25.191-b12)
OS: Linux 4.4.0-105-generic amd64
第三、软件配置
Java环境配置
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
gradle配置
下载(gradle-4.4.1-all.zip)
http://services.gradle.org/distributions/
配置环境变量
export GRADLE_HOME=~/tools/gradle-4.4
export PATH=${PATH}:${GRADLE_HOME}/bin
Android sdk环境变量
下载
http://tools.android-studio.org/index.php/sdk
配置环境变量
export ANDROID_HOME=~/tools/android-sdk-linux
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
更新所需要的sdk
查看Android版本
python@iZuf6bkt7m4txqajvno52yZ:~$ android -v list sdk
更新所有sdk(非必须)
python@iZuf6bkt7m4txqajvno52yZ:~$ android update sdk --no-ui
jenkins安装
下载
https://jenkins.io/download/
执行
python@iZuf6bkt7m4txqajvno52yZ:~/tools$ java -jar jenkins.war &
安装相应插件
配置jenkins(参考)
https://juejin.im/post/5b6a542b5188251a9e171bf2
https://juejin.im/post/5b6a542b5188251a9e171bf2
第四、遇到问题汇总
Failed to install the following Android SDK packages as some licences have not been accepted.
将本地sdk目录下的licenses文件夹中的License文件传到远程服务器中
Failed to install the following SDK components:build-tools;27.0.3 Android SDK Build-Tools 27.0.3
1、android list sdk -a
2、android update sdk -u -t 7 -a