Android -- jenkins + gradle + android automated apk building steps
Step 1: Install jenkins. There are many online tutorials.
Step 2: Download and configure gradle. Http://www.gradle.org/
Decompress gradle to a path such as/usr/local/lib/gradle-1.12
Configure environment variables:
$ Vi/etc/profile
Add
# Gradle
Export GRADLE_HOME =/usr/local/lib/gradle-1.12 (the path just unzipped)
Export PATH = $ PATH: $ GRADLE_HOME/bin
: Wq! After
$ Source profile
$ Echo $ GRADLE_HOME
Check whether the configuration is successful.
Step 3: Configure gradle in jenkins.
Choose Jenkins-system management-management plug-in-select "gradle plugin" to download and install the plug-in. If the network is poor, you can also download the plug-in for installation.
After the download is successful, choose System Management> system Settings> gradle installation> Configure gradle_home and save it, as shown in.
Step 4: Download the android SDK and configure ANDROID_HOME
At the bottom of/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 make source take effect.
Step 5: Jenkins create a project task
Jenkins-new-build a free-style software project-
Source code management: select a specific version control software and enter the project URL. If you are svn, you only need to enter the svn address of the specific project in the Repository URL. The others are default.
Build periodically H 9 ** 1-6 indicates that an automatic build is performed every Monday to Saturday nine o'clock A.M. Click the question mark next to each item for detailed instructions and you can set it as needed.
Select the gradle version in the System Configuration. "clean build" indicates that the system is cleaned and then built. You can configure command lines on your own.
After the build, you may need to send an email or get the apk download. Select Archive the artifacts and enter the apk path as follows.
Select the last successful build result of "status"-"on the left of the project job-", and click Download apk.
Finally, let's list the problems that have occurred during my build for your reference:
1. In local. properties, the sdk. dir must be set to the ANDROID_HOME path.
2. The compileSdkVersion and buildToolsVersion of build. gradle must be consistent with the SDK in ANDROID_HOME.
3,/opt/adt-bundle-linux-x86_64-20140702/sdk/extras/android path may lack m2repository package, need to complete, otherwise may not be able to identify external-library in the support-v4/v7 package and dependencies, the reason is unknown.
4. I downloaded 64-bit files from the google develper android website. The linux version is 64-bit. The result is aapt: error while loading shared libraries: libz. so.1: cannot open shared object file: No such file or directory. The reason is that 64 indicates that the OS needs to run 32 because the application lacks a link library. $ yum install glibc. i686 download the library. I don't know why it will happen on the official website.
5. The lintOptions option may be added to the build. gradle script.
Android {
LintOptions {
AbortOnError false
}
}