The first step, install Jenkins, this online tutorial quite a lot.
The second step is to download and configure the Gradle. http://www.gradle.org/
Unzip the Gradle to a path, such as/usr/local/lib/gradle-1.12
To configure environment variables:
$ vi/etc/profile
At the bottom of the file, add
# Gradle
Export gradle_home=/usr/local/lib/gradle-1.12 (the path just unzipped)
Export path= $PATH: $GRADLE _home/bin
: After wq!
$ Source Source Profile
$ echo $GRADLE _home
Check whether the configuration was successful.
The third step is to configure Gradle in Jenkins.
jenkins-"System Management-" Management plugin-"select" Gradle plugin "download and install, the network is not good, you can also download plug-in installation.
After the successful download, System Management-"System Setup-" Gradle Installation-"Configure Gradle_home and save, such as.
Fourth step, download the Android SDK and configure Android_home
Also at the bottom of the/etc/profile add
#android
Export ANDROID_HOME=/OPT/ADT-BUNDLE-LINUX-X86_64-20140702/SDK
Export path= $ANDROID _home/tools: $ANDROID _home/platform-tools: $PATH
and source to make it effective.
Fifth step, Jenkins new Project task
jenkins-"New-" building a free-style software project-"
SOURCE management: Select specific version control software, and fill in the project URL, such as I am svn, just fill in the repository URL to the specific project SVN address, the other is the default.
Build periodically H 9 * 1-6 represents an automatic build once every Monday to Saturday nine o'clock in the morning. Click the question mark at the end of each entry to have a detailed description that can be set on demand.
Select the Gradle version in the system setup, and the clean build represents clean and build every time. You can configure the command line yourself
After the build may need to send an email or get apk download, as below, select Archive the artifacts and fill in the APK path.
Select the project job-left "status"-the last successful build result, and click Download apk.
Finally, I'll give you some examples of the problems I've built up:
1, local.properties Sdk.dir need to set into Android_home path
2, Build.gradle compilesdkversion, buildtoolsversion need to be consistent with the SDK in Android_home
3,/opt/adt-bundle-linux-x86_64-20140702/sdk/extras/android path may be missing m2repository package, need to complete, Otherwise it may not be possible to identify the external-library in the SUPPORT-V4/V7 package and rely on, for unknown reasons.
4, I am in the Google develper Android official website download 64 bit, the Linux version is 64 bit, the result is reported aapt:error while loading shared libraries:libz.so.1:cannot open sh Ared object File:no such file or directory because 64 is required for the OS to run 32 for applications that are missing from the link library, and the Yum install glibc.i686 download Library. I do not know why the official online down will be like this.
5. You may need to add the lintoptions option to the Build.gradle script.
android{
lintoptions {
Abortonerror false
}
}
Http://www.2cto.com/os/201410/343255.html
Android--jenkins+gradle+android Automation Build apk step (GO)