All Projects → quittle → gradle-android-emulator

quittle / gradle-android-emulator

Licence: Apache-2.0 license
Gradle plugin for starting the Android Emulator when running instrumentation tests

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to gradle-android-emulator

xmake-gradle
A gradle plugin that integrates xmake seamlessly
Stars: ✭ 31 (+3.33%)
Mutual labels:  gradle-plugin
aotc-gradle-plugin
Ahead-of-Time Compilation in Gradle projects.
Stars: ✭ 17 (-43.33%)
Mutual labels:  gradle-plugin
kobby
Kobby is a codegen plugin of Kotlin DSL Client by GraphQL schema. The generated DSL supports execution of complex GraphQL queries, mutation and subscriptions in Kotlin with syntax similar to native GraphQL syntax.
Stars: ✭ 52 (+73.33%)
Mutual labels:  gradle-plugin
RapidMavenPushPlugin
A Gradle plugin : Upload Artifacts to Multi Maven Repository
Stars: ✭ 21 (-30%)
Mutual labels:  gradle-plugin
gradle-marytts-voicebuilding-plugin
A replacement for the legacy VoiceImportTools in MaryTTS
Stars: ✭ 14 (-53.33%)
Mutual labels:  gradle-plugin
bye-bye-jetifier
Gradle Plugin to verify if you can keep Android Jetifier disabled
Stars: ✭ 173 (+476.67%)
Mutual labels:  gradle-plugin
npm-publish
Gradle plugin for NPM package publishing. Allows for arbitrary publishing as well as seamless integration with Kotlin JS/MPP plugins.
Stars: ✭ 66 (+120%)
Mutual labels:  gradle-plugin
allure-gradle
Allure Gradle Plugin
Stars: ✭ 62 (+106.67%)
Mutual labels:  gradle-plugin
licenser
A simple license header manager for Gradle
Stars: ✭ 32 (+6.67%)
Mutual labels:  gradle-plugin
dockerPreparePlugin
Gradle plugin to generate docker layer-friendly directory for spring boot applications
Stars: ✭ 44 (+46.67%)
Mutual labels:  gradle-plugin
scalatest-junit-runner
JUnit 5 runner for Scalatest
Stars: ✭ 30 (+0%)
Mutual labels:  gradle-plugin
gradle-release-plugin
Gradle plugin providing very minimal release version numbering (Git-specific)
Stars: ✭ 43 (+43.33%)
Mutual labels:  gradle-plugin
chainsaw
Gradle plugin: adds support for building Java 9 modules.
Stars: ✭ 71 (+136.67%)
Mutual labels:  gradle-plugin
webdriver-binaries-gradle-plugin
A Gradle plugin that downloads and caches WebDriver binaries specific to the OS the build runs on
Stars: ✭ 31 (+3.33%)
Mutual labels:  gradle-plugin
corda-gradle-plugins
Gradle plugins used by Corda and Cordapps
Stars: ✭ 21 (-30%)
Mutual labels:  gradle-plugin
jetbrains-gradle-plugins
Gradle plugins for Docker, Terraform and Liquibase.
Stars: ✭ 22 (-26.67%)
Mutual labels:  gradle-plugin
gradle-versioner
Gradle Version Plugin. Generates semantic versions with git meta data per branch.
Stars: ✭ 25 (-16.67%)
Mutual labels:  gradle-plugin
android-gradle-plugins
Gradle Plugins for Android builds
Stars: ✭ 12 (-60%)
Mutual labels:  gradle-plugin
StringFuck
Yet Another String Obfuscator for Android
Stars: ✭ 50 (+66.67%)
Mutual labels:  gradle-plugin
StaticBus
🚌 A static bus use in modules.
Stars: ✭ 15 (-50%)
Mutual labels:  gradle-plugin

Android Emulator Plugin Gradle Plugin Version CircleCI

This plugin adds tasks that install an Android emulator and start it up when running instrumentation tests. Includes configuration for specifying the emulator configuration.

This plugin will automatically accept all Android SDK licenses when installing the emulator and emulator system images. Before using the plugin or upgrading Android SDK versions, make sure you are okay accepting the licenses for those versions.

Consumption

The minimum requirement for consumption is to simply apply this plugin.

build.gradle

// Consume from Gradle plugin repository. This is the only required step.
plugins {
    id 'com.quittle.android-emulator' version 'X.X.X'
}

// Consume android plugin as usual.
apply plugin: 'android'

android {
    // Fill out normally
}

// Optional configuration
androidEmulator {
    emulator {
        name 'my_avd_emulator_name' // Defaults to be dynamically based on the configuration of the AVD
        device 'pixel_xl' // Defaults to exclude the device flag, using avdmanager default. For options, run avdmanager list device
        sdkVersion 28 // Defaults to (Target SDK), then (Min SDK), then finally 10
        abi 'x86_64' // Defaults to x86
        includeGoogleApis true // Defaults to false
    }

    enableForAndroidTests false // Defaults to true
    avdRoot '~/.android/avd' // Defaults to be <gradle-build-dir>/android-avd-root
    headless true // Defaults to false but should be set to true for most CI systems
    additionalSdkManagerArguments '--proxy=http', '--proxy_host=56.78.90.12', '--proxy_port=1234' // Additional arguments to pass to the sdkmanager when used to install dependencies. See https://developer.android.com/studio/command-line/sdkmanager#options for options
    additionalEmulatorArguments '-no-snapshot', '-http-proxy=localhost:1234' // Additional arguments to pass to the emulator at startup. See https://developer.android.com/studio/run/emulator-commandline#startup-options for options
    logEmulatorOutput true // Defaults to false but can be enabled to have emulator output logged for debugging.
}

Tips & Tricks

Emulator failing to start

If the emulator fails to start with an error like

Emulator exited abnormally with return code 1

and you are unsure what the cause is, set androidEmulator { logEmulatorOutput true } and re-run the gradle build or even just building the waitForAndroidEmulator with the --debug flag should do the trick. You should now see the emulator stdout and stderr being logged with error messages if there was a bad combination of startup flags.

Custom test task

If you have a reason to run a custom instrumentation test task rather than the default one generated by the Android Gradle plugin, you can certainly do so. All you must do to ensure the emulator is spun up and down at the appropriate times is

  1. Configure your task to depend on waitForAndroidEmulator
  2. Configure your task to be finalized by stopAndroidEmulator

Development

In general, perform builds in the context of each folder, rather than as a multi-project Gradle build. This is necessary because the example-android-project will fail to configure without the plugin being locally available so the android-emulator-plugin project must be built and deployed locally first.

In general, to build and test locally do the following

$ ./gradlew -p android-emulator-plugin # This runs all the default tasks
$ ./gradlew -p android-emulator-plugin publishToMavenLocal # Publishes it for the example-android-project to consume
$ ./validate_plugin # Integration test to validate the plugin works

Deployment

This package is deployed via CircleCI. See .circleci/config.yml for the CI/CD setup.

In the configuration for the project on CircleCI, GRADLE_PUBLISH_KEY and GRADLE_PUBLISH_SECRET are injected as environment variables.

Upon check-in to the main branch, CircleCI checks out and builds the plugin. When a commit is tagged, a new version of the plugin will be released using the tag version number.

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].