All Projects → CircleCI-Public → android-image-preview-docs

CircleCI-Public / android-image-preview-docs

Licence: other
Docs for the preview of the Android machine image on CircleCI

Projects that are alternatives of or similar to android-image-preview-docs

Docker Android
Android in docker solution with noVNC supported and video recording
Stars: ✭ 4,042 (+22355.56%)
Mutual labels:  emulator, android-emulator
retro-computing
🤓🕹💾 This hobby project contains software implementations of old microprocessors and complete computer systems. I'm very interested in retrocomputing and this is how I learn about the inner workings of these old, classic and amazing computers and game consoles.
Stars: ✭ 15 (-16.67%)
Mutual labels:  emulator
react-sendbird-messenger
ReactJS (React-router-dom v6 + Antdesign + Firebase + Sendbird + Sentry) codebase containing real world examples (CRUD, auth, advanced patterns, etc).
Stars: ✭ 39 (+116.67%)
Mutual labels:  circleci
spellcard
A Leiningen template for k8s deployment automation.
Stars: ✭ 15 (-16.67%)
Mutual labels:  circleci
chip8
CHIP-8 emulator and (dis)assembler
Stars: ✭ 15 (-16.67%)
Mutual labels:  emulator
Corium
Corium is a modern scripting language which combines simple, safe and efficient programming.
Stars: ✭ 18 (+0%)
Mutual labels:  emulator
rusty-boy
Gameboy emulator in Rust
Stars: ✭ 20 (+11.11%)
Mutual labels:  emulator
bevm
Basic computer emulator
Stars: ✭ 20 (+11.11%)
Mutual labels:  emulator
jt tools
Ruby on Rails Continuous Deployment Ecosystem to maintain Healthy Stable Development
Stars: ✭ 13 (-27.78%)
Mutual labels:  circleci
drupal9ci
One-line installers for implementing Continuous Integration in Drupal 9
Stars: ✭ 137 (+661.11%)
Mutual labels:  circleci
webretro
RetroArch in your browser
Stars: ✭ 38 (+111.11%)
Mutual labels:  emulator
FEX
A fast usermode x86 and x86-64 emulator for Arm64
Stars: ✭ 650 (+3511.11%)
Mutual labels:  emulator
bot
Completely free and open-source human-like Instagram bot. Powered by UIAutomator2 and compatible with basically any Android device 5.0+ that can run Instagram - real or emulated.
Stars: ✭ 321 (+1683.33%)
Mutual labels:  emulator
emul8080r
An Intel 8080 emulator written in Swift
Stars: ✭ 17 (-5.56%)
Mutual labels:  emulator
spring-boot-microservice-best-practices
Best practices and integrations available for Spring Boot based Microservice in a single repository.
Stars: ✭ 139 (+672.22%)
Mutual labels:  circleci
cloudterm
Cloud Web Terminal Emulator. Opens your terminal to Web.
Stars: ✭ 58 (+222.22%)
Mutual labels:  emulator
Emux
GameBoy emulator written in C#
Stars: ✭ 58 (+222.22%)
Mutual labels:  emulator
rygar-emu
An emulator for the Rygar arcade game
Stars: ✭ 18 (+0%)
Mutual labels:  emulator
orb-starter-kit
A starter kit for new orb authors
Stars: ✭ 27 (+50%)
Mutual labels:  circleci
basicprograms
This repo contains basics programs of all languages.
Stars: ✭ 17 (-5.56%)
Mutual labels:  circleci

CircleCI Android machine image preview docs

We are excited to announce the preview of an Android machine image on CircleCI. The purpose of this repository is to walk you through the setup steps required to use the Android machine image.

What is the Android machine image on CircleCI?

CircleCI offers multiple kinds of environments for you to run jobs in. The Android machine image can be used via the Linux machine executor, like other Linux machine images on CircleCI. The Android machine image supports nested virtualization and x86 Android emulators, so it can be used for Android UI testing. It also comes with the Android SDK pre-installed.

Pre-installed Software

Android SDK

  • sdkmanager
  • Android platform 23, 24, 25, 26, 27, 28, 29, 30, S
  • Build tools 30.0.3
  • emulator, platform-tools, tools
  • NDK (Side-by-side) 21.4.7075529
  • cmake 3.6.4111459
  • extras;android;m2repository, extras;google;m2repository, extras;google;google_play_service

Others

  • gcloud
  • OpenJDK 8, OpenJDK 11 (default)
  • maven 3.6.3, gradle 6.8.3, ant
  • nodejs 12.21.0, 14.16.0 (default), 15.11.0
  • python 2.7.18, python 3.9.2
  • ruby 2.7.2, ruby 3.0.0
  • docker 20.10.5, docker-compose 1.28.5
  • jq 1.6

Using the Android machine image

To use the Android machine image, edit your .circleci/config.yml file. Here are example configs, some of which leverage the circleci/android orb for a simplified config. More examples are available here.

Simple job example

# .circleci/config.yaml
version: 2.1
orbs:
  android: circleci/[email protected]
workflows:
  test:
    jobs:
      # This job uses the Android machine image by default
      - android/run-ui-tests:
          # Use pre-steps and post-steps if necessary
          # to execute custom steps before and afer any of the built-in steps
          system-image: system-images;android-29;default;x86

Example of using the Android machine image in your own job

This example shows how you could modify your existing job to run UI tests.

# .circleci/config.yml
version: 2.1
orbs:
  android: circleci/[email protected]
jobs:
  test:
    # Use the Android machine image
    executor:
      name: android/android-machine
      resource-class: large
    steps:
      - checkout
      # Creates an AVD and starts up the emulator using the AVD.
      # While the emulator is starting up, the gradle cache will
      # be restored and the Android app will be assembled.
      # When the emulator is ready, UI tests will be run.
      # After the tests are run, the gradle cache will be saved (if it
      # hasn't been saved before)
      - android/start-emulator-and-run-tests:
          system-image: system-images;android-29;default;x86
      #   The cache prefix can be overridden
      #   restore-gradle-cache-prefix: v1a
      #
      #   The command to be run, while waiting for emulator startup, can be overridden
      #   post-emulator-launch-assemble-command: ./gradlew assembleDebugAndroidTest
      #
      #   The test command can be overridden
      #   test-command: ./gradlew connectedDebugAndroidTest
workflows:
  test:
    jobs:
      - test

Example of using more granular orb commands

This example shows how you can use more granular orb commands to achieve what the start-emulator-and-run-tests command does.

# .circleci/config.yml
version: 2.1
orbs:
  android: circleci/[email protected]
jobs:
  test:
    executor:
      name: android/android-machine
      resource-class: large
    steps:
      - checkout
      # Create an AVD named "myavd"
      - android/create-avd:
          avd-name: myavd
          system-image: system-images;android-29;default;x86
          install: true
      # By default, after starting up the emulator, a cache will be restored,
      # "./gradlew assembleDebugAndroidTest" will be run and then a script
      # will be run to wait for the emulator to start up.
      # Specify the "post-emulator-launch-assemble-command" command to override
      # the gradle command run, or set "wait-for-emulator" to false to disable
      # waiting for the emulator altogether.
      - android/start-emulator:
          avd-name: myavd
          no-window: true
          restore-gradle-cache-prefix: v1a
      # Runs "./gradlew connectedDebugAndroidTest" by default.
      # Specify the "test-command" parameter to customize the command run.
      - android/run-tests
      - android/save-gradle-cache:
          cache-prefix: v1a
workflows:
  test:
    jobs:
      - test

No-orb example

Here is an example of using the image, without using the circleci/android orb. These steps are similar to what is run when you use the run-ui-tests job of the orb.

# .circleci/config.yml
version: 2.1
jobs:
  build:
    machine:
      image: android:202102-01
    # To optimize build times, we recommend "large" and above for Android-related jobs
    resource_class: large
    steps:
      - checkout
      - run:
          name: Create avd
          command: |
            SYSTEM_IMAGES="system-images;android-29;default;x86"
            sdkmanager "$SYSTEM_IMAGES"
            echo "no" | avdmanager --verbose create avd -n test -k "$SYSTEM_IMAGES"
      - run:
          name: Launch emulator
          command: |
            emulator -avd test -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
          background: true
      - run:
          name: Generate cache key
          command: |
            find . -name 'build.gradle' | sort | xargs cat |
            shasum | awk '{print $1}' > /tmp/gradle_cache_seed
      - restore_cache:
          key: gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}
      - run:
          # run in parallel with the emulator starting up, to optimize build time
          name: Run assembleDebugAndroidTest task
          command: |
            ./gradlew assembleDebugAndroidTest
      - run:
          name: Wait for emulator to start
          command: |
            circle-android wait-for-boot
      - run:
          name: Disable emulator animations
          command: |
            adb shell settings put global window_animation_scale 0.0
            adb shell settings put global transition_animation_scale 0.0
            adb shell settings put global animator_duration_scale 0.0
      - run:
          name: Run UI tests (with retry)
          command: |
            MAX_TRIES=2
            run_with_retry() {
               n=1
               until [ $n -gt $MAX_TRIES ]
               do
                  echo "Starting test attempt $n"
                  ./gradlew connectedDebugAndroidTest && break
                  n=$[$n+1]
                  sleep 5
               done
               if [ $n -gt $MAX_TRIES ]; then
                 echo "Max tries reached ($MAX_TRIES)"
                 exit 1
               fi
            }
            run_with_retry 
      - save_cache:
          key: gradle-v1-{{ arch }}-{{ checksum "/tmp/gradle_cache_seed" }}
          paths:
            - ~/.gradle/caches
            - ~/.gradle/wrapper
workflows:
  build:
    jobs:
      - build

Limitations

  • There may be up to 2 mins of spin-up time before your job actually starts running. This time will decrease as more preview customers start using the Android image.
  • Only one image is currently available, android:202102-01. It contains most of the tools you’ll likely need for Android development. If there is software you require that’s not available in the image, please open an issue to let us know.
  • We may change and update the pre-installed software on the android:202102-01 image without prior notice during the preview period. Once the preview period is over, the images for Android images will be stable and will follow our standard image release cadence.

Pricing

For pricing information, refer to the Linux machine executors under the “Linux VM" section on the pricing page.

How to provide feedback

Please open an issue with any feedback. The specific areas where we would appreciate feedback:

  • Software pre-installed in the image. Do you find everything you need in the image?
  • Are there any bugs that you’ve noticed in the pre-installed software?
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].