Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Java for Android
  • Android Studio
  • Android Kotlin
  • Kotlin
  • Flutter
  • Dart
  • Android Project
  • Android Interview
Open In App
Next Article:
Github Actions For Android
Next article icon

Github Actions For Android

Last Updated : 03 Jan, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. CI/CD methodology provides speed, accuracy, and reliability. It increases the release rates by detecting the failures faster. Android is a widely used mobile operating system and developing apps for Android with GitHub Actions can be a game-changer.

Advantages of using GitHub Actions for Android:

  1. Helps us to run tests
  2. Make sure that the application complies when merging new code
  3. Builds and Publishes the application.

So here we are going to discuss how we can use GitHub Action for developing Android Apps in a step-by-step manner.

Step 1 :

Open your GitHub Repository containing the source code of your Android app and navigate to the Actions tab.

Step 2:

Next, you will see a screen like this -

As we are using GitHub action for Android, so we will choose Android CI from here and click on Configure option.

Step 3:

After selecting Android CI, you will land on this page where a template will be given but we will replace the given code.

The given code we will replace with the following code -

name: Android CI    on:    push:      branches: [ master ]    pull_request:      branches: [ master ]    jobs:    build:        runs-on: ubuntu-latest        steps:      - uses: actions/checkout@v2      - name: set up JDK 11        uses: actions/setup-java@v2        with:          java-version: '11'          distribution: 'adopt'          cache: gradle      - name: Grant execute permission for gradlew        run: chmod +x gradlew      - name: Build with Gradle        run: ./gradlew build      - name: Build debug APK        run: bash ./gradlew assembleDebug --stacktrace      - name: Upload APK        uses: actions/upload-artifact@v1        with:            name: app            path: app/build/outputs/apk/debug/app-debug.apk

After this, select the Start Commit option.

The explanation for the above code :

  1. The first line of code name: Android CI is to give a name to our workflow.
  2. Then we are setting up our workflow to run on the push events to the master branch and on the pull requests that target the master branch.
  3. Within the jobs section, we are defining it to run on the Ubuntu operating system.
  4. After that, we set up the JDK and grant the required execute permissions,

Next, we are using Gradle build to build our APK file and using predefined action which is actions/upload-artifcat@v1 to upload the APK file.

All this code for workflows is stored in a .yml or .yaml file under the project's main folder in the path .github/workflows

Step 4:

After committing, you can find the workflow on the Action Tab of your repository. 

Step 5:

Now you can expand the details of your workflow results by clicking on it.

We can see the link named “App” under the Artifacts heading. If we click on it then a zip file will be downloaded which contains the APK. 

Now every time any pull request or commit happens in this repository this workflow will run automatically and it will build the APK file and help us to identify any error in the build. We have taken a very simple code snippet here for the workflow but that can be further modified for unit testing and other specialized requirements of the development process.  You can refer to the Official documentation for code syntax of GitHub Actions to learn more about it.


Next Article
Github Actions For Android

S

satyajit1910
Improve
Article Tags :
  • Android
  • GitHub

Similar Reads

    GitHub Actions
    Automation is important in software development to reduce manual effort, improve efficiency, and streamline workflows. GitHub Actions is a built-in CI/CD (Continuous Integration and Continuous Deployment) tool in GitHub that allows developers to automate tasks such as building, testing, and deployin
    7 min read
    Automated Release for Android Using GitHub Actions
    Automating the release process for Android applications can significantly enhance efficiency, reduce manual errors, and ensure consistent delivery. GitHub Actions provides a powerful platform to automate workflows directly from your GitHub repository. This article will guide you through setting up a
    3 min read
    Basic CI Workflow For Android using GitHub Actions
    Continuous integration (CI) is a software development process in which the team members can integrate their work. For Android developers, setting up a CI pipeline can greatly enhance productivity and code quality. GitHub Actions, a powerful automation tool integrated into GitHub, provides an excelle
    2 min read
    REST API Endpoints For GitHub Actions Variables
    GitHub Actions is used to automate workflows, build, test, and deploy code. To make workflows more dynamic and secure, GitHub Actions allows you to use variables, which can store data like configuration values, secrets, or other necessary information. GitHub exposes a REST API to manage these variab
    5 min read
    How do I use Docker with GitHub Actions?
    Docker packages all the components required for software into containers, much like a recipe box. By automating chores in your development workflow, GitHub Actions serves as your personal chef. When combined, they optimize software development by effectively packaging applications and smoothly autom
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences