Install Jenkins

  1. Open Terminal and type below commands:

    wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
    sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
    sudo apt-get update
    sudo apt-get install jenkins
    

    Official Website

  2. Open browser and entry Jenkins page with below address:

    http://localhost:8080

Install Plugins

  1. Visit Manage Jenkins -> Manage Plugins -> Available
  2. Check the following plugins :

    Gradle Plugin、Git Plugin、Git Client Plugin、Bitbucket Plugin

  3. Click Install without restart

Configuring Global Security

  1. Visit Manage Jenkins -> Configure Global Security
  2. Check Enable security
  3. Check Jenkins' own user database in Access Control
  4. Uncheck Allow users to sign up
  5. Check Matrix-based security in Authorization
  6. Press Apply

Configuring System

  1. Visit Manage Jenkins -> Configure System
  2. Go to Environment variables
  3. Type ANDROID_HOME with name and SDK location with value

    /opt/Android/sdk

  4. Extended Email Notification

    1. Typesmtp.gmail.cominto SMTP Server field
    2. Check Add 'Precedence: bulk' Email Header
    3. Type your email address into Default Recipients field
  5. E-mail Notification

    1. Typesmtp.gmail.cominto SMTP Server field
    2. Check Use SMTP Authentication field
    3. Type your email address and password into username and password fields
    4. Check Use SSL
    5. SMTP Port is 465

New Item

  1. Press New Item
  2. Type project name
  3. Select Free-style project
  4. Select Git in Source Code Management
  5. Type Repository URL with Bitbucket
  6. Add and select credentials

    Kind is Username with password; Type username、password then save it

  7. Press Add build step at Build and select Invoke Gradle script
  8. Select Use Gradle Wrapper
  9. Type clean build to Tasks
  10. Check From Root Build Script Dir
  11. Press Add post-build action to add Archive the artifacts and E-mail Notification in Post-build Actions
  12. Type**/*.apkinto Files to archive in Post-build Actions
  13. Type our mail address to Recipients in E-mail Notification*

Configuring Android Studio Project

  1. Set the Android SDK path in local.properties file

    sdk.dir=/opt/android-sdk-linux

  2. Remove the NDK path (We still not install it.)
  3. Make sure it can auto sign our APK

    Configure the Build Process to Automatically Sign Your APK

Commit Android Project To Bitbucket

Use SourceTree to help us.

Build Android Project with Jenkins

  1. Entry our Jenkins project
  2. Press Build Now

Jenkins 結合 Bitbucket & Android Studio

results matching ""

    No results matching ""