Spoon Gradle Plugin

Gradle plugin for Spoon.
Alternatives To Spoon Gradle Plugin
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Kotlin44,8511,5233,600an hour ago77September 07, 2022154Kotlin
The Kotlin Programming Language.
8 hours ago8
收集整理Android开发所需的Android SDK、开发中用到的工具、Android开发教程、Android设计规范,免费的设计素材等。
Detekt5,454285 hours ago30August 30, 2021166apache-2.0Kotlin
Static code analysis for Kotlin
Gradle Retrolambda5,3886834 years ago40April 21, 201974apache-2.0Java
A gradle plugin for getting java lambda support in java 6, 7 and android
Packer Ng Plugin4,796321a year ago12March 03, 201721apache-2.0Java
下一代Android打包工具(对Gradle 7.x的支持,欢迎提PR)
Gradle Versions Plugin3,61711815 days ago20May 31, 201780apache-2.0Kotlin
Gradle plugin to discover dependency updates
2 years ago145apache-2.0Groovy
A Android gradle plugin that effects AspectJ on Android project and can hook methods in Kotlin, aar and jar file.
9 days ago232apache-2.0Groovy
Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
Aboutlibraries3,2441a day ago87August 19, 202214apache-2.0Kotlin
AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
Dexcount Gradle Plugin3,015
2 months ago45January 25, 20222apache-2.0Java
A Gradle plugin to report the number of method references in your APK on every build.
Alternatives To Spoon Gradle Plugin
Select To Compare

Alternative Project Comparisons

Spoon Gradle Plugin

Gradle plugin for Spoon. Allows you to run spoon with almost no effort under new Android build system.

Build Status

Plugin generates spoon${TEST_VARIANT} tasks for every test variation in your application project.


buildscript {
  repositories {

  dependencies {
    classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.2'

apply plugin: 'spoon'

// This section is optional
spoon {
  // for debug output
  debug = true

  // To run a single test class
  className = 'fully.qualified.TestCase'

  // To run a single method in TestCase
  methodName = 'testMyApp'

  // To execute the tests device by device */
  sequential = true

  // To grant permissions to Android M >= devices */
  grantAllPermissions = true

After applying the plugin you'll find spoon${TEST_VARIANT} tasks in your project.

You may run all the test variations with

gradle spoon

Generated reports are available at build/spoon/${TEST_VARIANT} folder.

For making screenshots add spoon-client dependency to your tests compile configuration:

dependencies {
  androidTestCompile 'com.squareup.spoon:spoon-client:1.6.4'

By default the plugin runs tests on all the connected devices. In order to run them on some concrete devices instead, you may specify their serial numbers:

spoon {
  devices = ['333236E9AE5800EC']
  skipDevices = ['serial-you-want-to-skip']

It is also allowed to specify specify size of tests that should be run. You may run all the tests annotated as @SmallTest with the following line:

gradle spoonSmall

Run gradle tasks for details about size rules.

You may also setup your project to take parameters for class/method to be run from command line. E.g.:

gradle spoon -PspoonClassName=fully.qualified.TestCase

And project configuration:

spoon {
  if (project.hasProperty('spoonClassName')) {
    className = project.spoonClassName  

Test Sharding

You can configure test sharding using the numShards and shardIndex properties (documentation):

spoon {
  numShards = 4
  shardIndex = 0

If you are specifying sharding for multiple devices, you may use spoon's built in auto-sharding by specifying:

spoon {
  shard = true

This will automatically shard across all specified serials, and merge the results.

Custom instrumentation arguments

Use the instrumentationArgs property on spoon extension to pass custom parameters to your tests:

spoon {
  instrumentationArgs = ["foo=bar", "name=value"]

Code Coverage

You can configure spoon to calculate code coverage by using codeCoverage property on spoon extension:

spoon {
  codeCoverage = true

This option requires your app to have the WRITE_EXTERNAL_STORAGE permission.

Known issues

If you have troubles with running Android Lint after this plugin is applied, try the following workaround

buildscript {
  // ...
  dependencies {
    classpath('com.stanfy.spoon:spoon-gradle-plugin:1.2.2') {
      exclude module: 'guava'
    classpath 'com.google.guava:guava:17.0'

You can find details in the related issue.


After making editions, run

./gradlew integrationTest

This will install the plugin to local maven repo and run spoon task in the example project.


Copyright 2013-2016 Stanfy Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
Popular Plugin Projects
Popular Gradle Projects
Popular Libraries Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Gradle Plugin