Example Android configuration

android
circle.yml
2.0

#1

I’m looking for an example configuration for 2.0. Ideally with tests running in the emulator. Has anyone managed to get this working?


#2

Hi Hans,

This might be possible with the machine executor, but there aren’t currently Android SDKs or emulators in docker images to use with the docker executor.

I believe my coworker forwarded you here because we’ve been talking about Android support in the future, but we still have much to figure out. I apologize for the confusion. I’ll follow up with you in your original support ticket.

Regards,
Eric


#3

Hey @Eric, I’ve managed to run Android builds with Docker on EC2 using docker-compose. My image is brantapps/android-build-environment. Alas, I haven’t got past pulling the image on CircleCI 2.0 right now (see this post) but I think that’s a separate issue… the bitrise/android image gets much further but fails on the usual inoccuous license issue (my app is using a much later version of build tools than that bundle with bitrise).


#4

Ok, I’ve built my first Android APK. Here’s my circle.yml.

version: 2
jobs:
  build:
    docker:
      - image: bitriseio/docker-android
    working_directory: ~/OceanLife
    steps:
      - checkout
      - run:
          name: Assemble & Test (Amazon Flavour)
          command: ./gradlew assembleWithAmazon testWithAmazonDebugUnitTest
          environment:
            TERM: dumb
      - run:
          name: Assemble & Test (Google Flavour)
          command: ./gradlew assembleWithGoogle testWithGoogleDebugUnitTest
          environment:
            TERM: dumb

#5

Do you use the Android emulator at all? We haven’t gotten that working on CircleCI 2.0, which many of our Android customers need.


#6

Hey @Eric - admittedly running emulators either via Geny or via the official Google emulation has always always been fraught with difficulty. Personally and at Just Eat, the overhead of maintaining the virtual device suite on a series of CI servers was getting tiresome. We now use the the Firebase Test Lab to run our espresso tests which connects us to Google’s device matrix and is basically just another step in our build pipeline which CircleCI would support as is. My advice (without business context) would be to advise users running local espresso tests via spawned emulators at build time to move to Firebase Cloud Test Lab and profit. :slight_smile: :thumbsup:


#7

I think there is a fundamental incompatibility between Docker and the Emulator too…When I am running docker locally no HAX emulator will launch! Bit out of my depth as to why…!


#8