Build an Android automatic packaging environment with Jenkins
Assume that you have set up the jenkins environment. Otherwise, see:
Installation Method
Jenkins is a java program, web page, and war format. It can be run under tomcat.
Use of ant packaging script
Ant build-f xxx/build. xml
The above is useful for just two sentences. Please write them here directly.
Jenkins is a java web project. You can download the war package from the official website and run it under tomcat's webapps.
Access localhost: 8080/jenkins
----------------------------------- Split line -----------------------------------
Automated Testing for building sustainable integration of robotium + jenkins + TMTS in Linux
Modify the jenkins port number in Ubuntu
Build jenkins in Linux
Jenkins Server installation and configuration
Configure role-based project permission management for jenkins
Install jenkins in Ubuntu Desktop 12.04 LTS
----------------------------------- Split line -----------------------------------
Enter the subject
Any development tool provides the command line tool. For example, Android uses ant. Java has maven. In addition, xcode and visual studio all have corresponding command line tools. We can write a shell script to complete the packaging.
Package the adnroid project with commands
The following command can be used to package Android projects. jenkins actually calls a similar command.
Ant build-f xxx/build. xml
Install plug-ins
Jenkins supports multiple plug-ins, which can be used after being installed online. Common plug-ins include git plug-ins, ant plug-ins, and maven plug-ins.
In the upper left corner of the jenkins homepage, choose System Management> Manage ins.
Click "optional plug-ins" and search for git, and choose to install git plugin (or install several more plug-ins, such as git client plugin)
Install ant plugin in the same way
You may need to restart jenkins by restarting tomcat. Programmer, restart several times if an error occurs.
Create a project
Click new in the upper left corner of the jenkins homepage.
Name the project and select a free-style project.
Configuration item
If you do not directly enter here, click Project and click "configuration" on the left"
It looks like this.
Select git in the source code management office and configure logon information.
Click "build" and click "add build step" and select invoke Ant. (If this option is not available, it means you have not installed the ant plug-in. Follow the steps above to install the plug-in)
Click "advanced" and set the details. (If you do not know ant, please make up your ant knowledge)
You can save the settings.
Build
On the project page, click on the left side to build now. Start building. The build history below lists the building history. The red ball indicates that the building fails, and the blue ball indicates that the building is successful.
Solution after building an error
In build history, find the building record of the error, and click Console Output (or Console Output) to view the cause of the error.
Where is the android package (apk )?
For my mac, put
/Users/***/. jenkins/workspace/reed_android/code/proj. android/bin
.
You can add a building step during project configuration and select Execute shell to Execute a shell command, such as executing the file copy command and placing the generated apk file elsewhere. (Execute windows batch command for Windows)
This article permanently updates the link address: