Jenkins Android Build 1


  • Jenkins 2.7.1
  • Ubuntu 16.4
  • Android Linux(Android Tool only)
  • Source Target is Github


  • Download jekins war file
  • Download Android tool
  • Install Android SDK
  • Preparation for jenkins(install plugin etc…)

Preparation installation

Download jenkins war file


You can download latest jenkins from jenkins website.

Preparation for Android

Prepare android tool space

mkdir android-sdk
cd android-sdk

Download Android tool
Use Android Tool not SDK.


tools directory is generated. This directory includes Android tools(Not SDK)
Update Android build-tool

cd tools/bin
./sdkmanager --update

You can update build tool.

Install SDK
Use android command under tool

cd tools
./android update sdk --no-ui

You can install all sdk.
If you don’t want to use GUI version, please add –no-ui option.
All SDK related folders under current directory.

Android Build(Test)

Now, we are ready to build Android.
Let’s try test build with gradle without jenkins.

aapt doesn’t work with 64bit env, please install following packages

sudo apt-get install lib32stdc++6
sudo apt-get install lib32z

For CentOS7, we need following

yum install zlib.i686 libstdc++.i686

Add ANDROID_HOME and PATH of tools to your bash_rc etc…

export ANDROID_HOME=/home/dj/lib/android-sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools


Download or create any project and try build

./gradlew build

If build is success, your Android build env is completed.

Preparation for jenkins

To start jenkins run war file

java -jar jenkins.war

You need to setup jenkins account
Skip this part

Install following plugin
“Manage Jenkins” -> “Manage Plugins”

  • Android Emulator Plugin(not required I guess)
  • Git plugin
  • Git client plugin
  • Git server Plugin
  • GitHub API Plugin
  • GitHub plugin
  • Gradle plugin

I think Git related plugins are installed by default.

Create Android Build

Create jenkins job
“New Item” -> “Freestyle project”

Setting are following part

  • General GitHub project
  • Source Code Management Git
  • Build Execute shell
  • Post-build Actions Archive the artifacts

General GitHub project
Set Git hub
jenkins general

Source Code Management Git
Set Git hub URL and user credentials(username, password)
git hub setting

Build Execute shell
Add android build with gradle(add ANDROID_HOME and PATH to android tool and platform-tools)
Android execution shell

Post-build Actions Archive the artifacts
Save ask as results
jenkins apk save

Build and Show result

Try “Build Now”
If it is success,
any apks under project will be shown.