A simple template project for test-driven Android development using Robolectric and Maven
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Deckard (for Maven)

Build Status

Deckard is the simplest possible Android project that uses Robolectric for testing and Maven to build. It has one Activity (with an empty layout), and a Robolectric test that creates that Activity.

Deckard also imports seamlessly into IntelliJ, due to IntelliJ's support for Maven. Just import the pom.xml.

Eclipse is also supported. Install the m2e-android plugin for Eclipse, and import the project as a Maven project. After importing into Eclipse, you have to mark the consume-aar goal as ignored, since aar consumption is not yet supported by m2e-android. To do this, simply apply the Quick fix on the "Plugin execution not covered by lifecycle configuration" error.


Note: These instructions assume you have a Java 1.6 JDK installed.

To start a new Android project:

  1. Install the Android SDK. On Mac OS X with Homebrew just run:

    brew install android-sdk
  2. Set your ANDROID_HOME environment variable to /usr/local/opt/android-sdk.

  3. Install Maven if you haven't already (run mvn to check). On OS X (as before) this is easiest with Homebrew:

    brew install maven
  4. Download Deckard from GitHub:

    wget https://github.com/robolectric/deckard-maven/archive/master.zip
    unzip master.zip
    mv deckard-maven-master my-new-project
  5. Run the setup script to install dependencies into Maven:

  6. In the project directory you should be able to run the tests:

    cd my-new-project
    mvn clean test
  7. Optionally, import the project into IntelliJ (or Eclipse) by selecting 'Import Project' in IntelliJ and selecting the project's pom.xml. When prompted to pick an SDK you just need to select the Android SDK home and your JDK.

  8. Change the names of things from 'Deckard' to whatever is appropriate for your project. Package name, classes, and the AndroidManifest are good places to start.

  9. Build an app. Win.