I've already introduced the use of Maven to build, to introduce Gralde's automated build.
What is Gralde? The official explanation is that
Gradle is an open source build automation system. Gradle can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or indeed anything else. Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven to a more effec tive to build. Powered by Build programming Language, Gradle is concise yet expressive.
The environment setup steps are roughly the same as Maven's, just replace Maven with Gralde.
Download Gralde, unzip, and add the Gralde Bin directory to the environment variable path, then configure Jenkins, select "Manage Jenkins" and "Set system" and fill in the corresponding settings with the directory path just Gralde. Finally installs the Gradle plugin in Jenkins's plug-in program.
Specific examples of Gralde
Top-level build file where can add configuration options common to all Sub-projects/modules.buildscript {Reposito Ries { mavencentral () } dependencies { classpath ' com.android.tools.build:gradle:1.0.0 ' // Note:do not place your application dependencies here; They belong //In the individual module Build.gradle files }}allprojects { repositories { mavenlocal () C9/>maven { url "Http://localhost/repo"}} }
Apply plugin: ' com.android.application '//apply plugin: ' Com.android.library ' android {compilesdkversion ' Buildtool Sversion "21.1.2" defaultconfig {applicationid "Com.example.demo" minsdkversion On Versioncode 1 Versionname "2.1.1"} signingconfigs {releaseconfig {storefile File (system.getenv ("KEYSTORE")) Storepassword system.getenv ("Keystore_password") Keyalias system.ge Tenv ("Key_alias") Keypassword system.getenv ("Key_password")}} buildtypes {release { Signingconfig Signingconfigs.releaseconfig}} packagingoptions {exclude ' meta-inf/license.txt '} lintoptions {Abortonerror false} sourcesets {main {manifest { Srcfile ' Src/main/androidmanifest.xml '} java {srcdir ' Src/main/java '} res { Srcdir ' Src/main/res '} assets {Srcdir ' assets '}}}}de pendencies {Compile filetree (dir: ' Libs ', include: [' *.jar ']) Compile project (': Framework ') compile ' com.example : libxxx:1.0 '}
The configuration settings for the project in Jenkins also need to be changed
Automatic building of Android projects using Jenkins (6)