2.
The document provides steps to integrate Android Application with Jenkins.
The integration process requires following steps ‐
1. System Requirements
2. Download Jenkins
3. Starting Jenkins
4. How to Install Tomcat in Windows
5. Configure Apache with Jenkins
6. Jenkins First Look
7. Configuration
8. JDK Setup
9. PlugIn Installation
10. List of Necessary Plugins
11. Jenkins New Project Setup
12. Get Project from Repository
13. Build Android Project
14. Email Notification
15. Advanced Setting
16. Set Success Trigger
17. Setup Notification Detail
18. Set Failure Trigger
19. Setup Notification Detail
20. Project Build Error
21. Build the Project
BrainBox Network. Copyright@2015. All rights reserved
3.
SYSTEM REQUIREMENTS
➔ JDK :JDK 1.5 or above
➔ Memory:2GB RAM (recommended)
➔ Disk Space:No minimum requirement. Note that since all builds will be stored on the Jenkins
machines, it has to be ensured that sufficient disk space is available for build storage.
➔ Operating System Version:Jenkins can be installed on Windows, Ubuntu/Debian, Red
Hat/Fedora/CentOS, Mac OS X, openSUSE, FReeBSD, OpenBSD, Gentoo.
➔ Java Container:The WAR file can be run in any container that supports Servlet 2.4/JSP 2.0 or
later.(An example is TOMCAT/APACHE).
BrainBox Network. Copyright@2015. All rights reserved
4.
DOWNLOAD JENKINS
➔ Open Given Link :https://jenkins‐ci.org/
➔ Download Jenkins for system
BrainBox Network. Copyright@2015. All rights reserved
5.
STARTING JENKINS
➔ Open the command prompt,
➔ Browse to the directory where the “Jenkins.war” file is present.
➔ Run the following command:
Mostly Jenkins installation directory location is:C:Program Files (x86)Jenkins
Command:Java –jar Jenkins.war
➔ Accessing Jenkins: Once Jenkins is up and running,
You can access Jenkins from the link − http://localhost:8080
BrainBox Network. Copyright@2015. All rights reserved
7.
CONFIGURE APACHE WITH JENKINS
➔ Copy the Jenkis.warfile and PASTE it to the webapps folder in the tomcat folder.
➔ Now open thecommand prompt
➔ Browse to the bin directory in this folder and run the start.bat file
E:Appstomcat7bin>startup.bat
➔ Then open http://localhost/jenkins
BrainBox Network. Copyright@2015. All rights reserved
9.
CONFIGURATION
➔ Click on “Manage Jenkins” link, showing in left side bar of the screen.
➔ Click on “Configuration Setting”, showing in the container part of the screen.
BrainBox Network. Copyright@2015. All rights reserved
10.
JDK SETUP
➔ Click on “JDK Installations” button
➔ Set JDK path, where you want the install JDK in your machine.
➔ Then click “Save”
BrainBox Network. Copyright@2015. All rights reserved
11.
➔ Then click on “Available” button
➔ Then put the “Go to next Slide” in your “Filter” showing in right top corner.
➔ Check and select Plugin,
➔ Then Click “Download now and install after restart” button
BrainBox Network. Copyright@2015. All rights reserved
12.
INSTALL PLUGIN
➔ Click on “Manage Plugin” icon, it is located in container part of the screen.
BrainBox Network. Copyright@2015. All rights reserved
13.
LIST FOR NECESSARY PLUGINS
1. Credentials Plugin
2. Email Extension Plugin
3. Google Authenticated Source plugin
4. Google Login Plugin
5. Google OAuth Credentials plugin
6. Gradle plugin
7. Subversion Plug‐in
8. OAuth Credentials plugin
9. SSH Credentials Plugin
➔ Go to “Configure System”
➔ Go to extended email notification
➔ Click “Advanced”
➔ Fill in blank:
1. SMTP server ‐> smtp.gmail.com (Mandatory)
2. Use SMTP Authentication ‐> CHECK TRUE (Mandatory)
3. USER NAME ‐> <YOUR_EMAIL_ID> (Mandatory)
4. PASSWORD ‐> <YOUR_EMAIL_ID_PASSWORD> (Mandatory)
5. USE SSL ‐> CHECK TRUE (Mandatory)
6. SMTP PORT ‐> 465 (Mandatory)
7. Default Recipients ‐> <ANY EMAIL ID> (Mandatory)
➔ Save and Restart.
BrainBox Network. Copyright@2015. All rights reserved
14.
JENKINS NEW PROJECT SETUP
➔ OPEN http://localhost:8080/
➔ Create new Job:Click on “New Item”
➔ Enter your project name in “Item Name” text box
➔ Check true “Freestyle project”
➔ Press “OK”
BrainBox Network. Copyright@2015. All rights reserved
15.
GET PROJECT FROM REPOSITORY
➔ Go to “Source Code Management” block
➔ Select “Subversion”
➔ Enter Repository Url”
➔ Insert “Use Svn update as much as possible” in the “Check‐out Strategy” field
➔ Press “Apply”
➔ In first time Svn setup you also configure Svn credential
➔ Click “Enter Credentials”, and enter your Svn credentials
BrainBox Network. Copyright@2015. All rights reserved
16.
BUILD ANDROID PROJECT
➔ Go To “Build Tag”
➔ Click on “Add Build Setup”
➔
➔ Select “Execute windows batch command”
➔ Paste below code in Command Prompt:
gradlew.bat assembleDebug
➔ ADD ONE MORE COMMAND BOX by clicking on “Add build step” and paste below code
➔ if exist temp rmdir temp /S /Q
➔ if not exist temp mkdir temp
copy /Y "%WORKSPACE%appbuildoutputsapk<YOUR_APK_NAME>.apk"
"temp<YOUR_APK_NAME>_%BUILD_NUMBER%.apk"
move /Y "%WORKSPACE%appbuildoutputsapk<YOUR_APK_NAME>.apk"
"c:Program Files (x86)JenkinsuserContent"
➔ As shown below :‐
BrainBox Network. Copyright@2015. All rights reserved
17.
➔ Press “Apply”.
EMAIL NOTIFICATION
➔ NOTIFICATION ON SUCCESS BUILD (SEND APK WITH NOTIFICATION)
1. Go To post build action tag
2. Select “Add Post build action”
3. Select “Editable Email Notification”
BrainBox Network. Copyright@2015. All rights reserved
19.
SET SUCCESS TRIGGER
➔ Go To “Trigger” tag
➔ Press “Add Trigger”
➔ Select “success”
➔ Screen looks like below screen
➔ Select “Advanced”.
BrainBox Network. Copyright@2015. All rights reserved
20.
SETUP NOTIFICATION DETAIL
➔ Add “Recipient List” (Ex: mohit.mobifly@gmail.com)
➔ Set “Subject” (Ex: $PROJECT_NAME ‐ $BUILD_NUMBER ‐ $BUILD_STATUS)
➔ Set “Content” :
<html>
<body>
<h4>Build # $BUILD_NUMBER ‐ $BUILD_STATUS</h4>
<h4>APK Name: <YOUR_APK_NAME>_$BUILD_TYPE_ $BUILD_NUMBER .apk</h4>
</body>
</html>
➔ Add “Attachments”
Copy & Paste given code:(temp/*.apk)
➔ Set “Attach Build Log”: If you want to attach any bulid log, then you have to select “Attach
Build Log” otherwise select “Do Not Attach Build Log”
BrainBox Network. Copyright@2015. All rights reserved
21.
SET FAILURE TRIGGER
➔ Go To “Trigger Tag”
➔ Press “Add Trigger”
➔ Select “Failure”
➔ Your screen will looks like below shown screen
BrainBox Network. Copyright@2015. All rights reserved
22.
SETUP NOTIFICATION DETAIL
➔ ADD Recipient List(Ex: mohit.mobifly@gmail.com)
➔ Set Subject (Ex: $PROJECT_NAME ‐ $BUILD_NUMBER ‐ $BUILD_STATUS)
➔ Set Content (<ANY INFORMATION>)
➔ Set “Attach Build Log” (Select “Attach Build Log”)
➔ Save and Build now.
BrainBox Network. Copyright@2015. All rights reserved
23.
PROJECT BUILD ERROR
➔ If during build a Project on jenkin , An exception occurs with message “The SDK directory
does not exist.”
As shown below :‐
➔ Then go through the jenkins directory of your system :
1. Open workspace folder under your project folder in jenkins directory
2. Update “local.properties” file with your local SDK path and save it.
BrainBox Network. Copyright@2015. All rights reserved
24.
NOW BUILD THE PROJECT
➔ On successful build of project.
➔ Find generated APK on your specified locations.
➔ Check your specified emails also.
BrainBox Network. Copyright@2015. All rights reserved
25.
Thank You So Very Much
For queries please write on ashish@mobifly.in
Developed By
Mohit Saini
Android Developer ‐ Mobifly
mobifly.in
BrainBox Network. Copyright@2015. All rights reserved