This guide will help you get started with an Android project on Semaphore. If you’re new to Semaphore please read our guided tour first.
Semaphore provides a set of tailored container images that Android developers can use as an environment for their projects on Semaphore. These pre-built images provide Android SDK and other common tools needed to run Android projects out of the box. Your task is only to configure CI/CD steps that are specific for your project.
Semaphore supports both Android and React Native projects.
You can run an Android emulator in Semaphore CI/CD jobs.
Here's an example Android configuration:
version: v1.0 name: Android example agent: machine: type: e1-standard-2 containers: - name: main image: semaphoreci/android:29 blocks: - name: Build task: jobs: - name: Hello Android commands: - checkout - echo "hello world"
Here's an example configuration for React Native projects:
version: v1.0 name: React Native example agent: machine: type: e1-standard-2 containers: - name: main image: semaphoreci/android:29-node blocks: - name: Install dependencies task: jobs: - name: npm install and cache commands: # Get the latest version of our source code from GitHub: - checkout # Restore dependencies from cache. This command will not fail in # case of a cache miss. In case of a cache hit, npm install will # run very fast. # For more info on caching, see https://docs.semaphoreci.com/guided-tour/caching-dependencies/ - cache restore - npm install # Store the latest version of node modules in cache to reuse in # further blocks: - cache store - name: Run Android tests task: prologue: commands: - checkout # Install Android emulator - sdkmanager "platform-tools" "platforms;android-24" "emulator" - sdkmanager "system-images;android-24;default;armeabi-v7a" - echo no | avdmanager create avd -n Nexus_S_API_24 -k "system-images;android-24;default;armeabi-v7a" --device "Nexus S" jobs: - name: Run tests commands: - cache restore - npm test
Android image variants#
The pre-built Android images are available on SemaphoreCI Docker Hub.
The source code and Dockerfiles for these images are available in an open source repository semaphoreci/docker-images.
The Semaphore Android images are based on the
ubuntu:16.04 official Docker
image. Jobs commands are executed by root user.
There are Docker images for each recent version of Android. There are also variants with Node.js preinstalled for React Native development.
android:versionis the basic image that comes with development utilities and is an optimal first choice.
android:version-nodeis an extension of the basic image and comes with Node.js (10.x) pre-installed.
For more information on using Docker images to define your Semaphore CI/CD environment, see Custom CI/CD environment with Docker documentation page.
Semaphore provides a demo React Native application with a working CI pipeline for Android and iOS that you can use to get started quickly:
Supported Android SDK versions#
- ARM simmulator (libqt5widgets5)
- Google Cloud SDK
- ruby 2.6.1