android-gradle-java-library-template icon indicating copy to clipboard operation
android-gradle-java-library-template copied to clipboard

Android Gradle Library Template

Android Gradle Java Library Template

License TravisCI OSX Build Coveralls Code Coverage Twitter Follow

Gradle + Android Studio + Robolectric + Espresso + Mockito + EasyMock/PowerMock + JaCoCo

Technologies used:

Build Tools:

Name Description
Gradle Gradle build system
Android Gradle Build Tools Official Gradle Plugin
Android SDK Official SDK
Android SDK Build Tools Official Build Tools
Android Studio or Official IDE
Intellij Intellij IDE

Testing Frameworks:

Name Description
JUnit Java Unit Testing Framework
AssertJ Matchers for Unit Tests
Mockito Mocking Framework

Reporting Plugins:

Name Description
JaCoCo JaCoCo Test Coverage
Coveralls Hosts test reports published from TravisCI

Continuous Integration:

Name Description
TravisCI Build Server(Builds, Tests, Publishes reports to Coveralls)

Getting Started:

Android Studio or Intellij Support(Simple):

  • Import/Open this project with Android Studio/Intellij(click on build.gradle)

  • Unit Tests:

  • Change the Build Variant Test Artifact to Unit Tests

  • Right click a unit test located in src/main/test and click test

Comand Line(Advanced):

Clone with Git:
  • git clone https://github.com/jaredsburrows/android-gradle-java-library-template.git
  • cd android-gradle-java-library-template
Publish via the Gradle "maven" plugin:
  • Install Maven debug flavor dependencies locally:
    • gradlew assembleDebug installArchives
  • Upload Maven debug flavor dependencies to a specified repository:
    • gradlew assembleDebug uploadArchives
Publish via the Gradle "maven-publish" plugin:
  • Install Maven debug flavor dependencies locally:
    • gradlew assembleDebug publishDebugPublicationToMavenLocalRepository
  • Upload Maven debug flavor dependencies to a specified repository:
    • gradlew assembleDebug publish
Publish via the Jfrog Bintray plugin:
  • Upload Maven debug flavor dependencies to Jfrog Bintray:
    • gradlew assembleDebug bintrayUpload
Running Unit Tests with Gradle:
  • Run all unit tests in all flavors:
    • gradlew test
  • Run a single unit test in all flavors:
    • gradlew test --tests="*MainActivityTest*"
  • Run all unit debug flavor tests:
    • gradlew testDebug
  • Run a single unit test in the debug flavor:
    • gradlew testDebug --tests="*MainActivityTest*"
  • Run a single unit test in the debug flavor with Jacoco test reports:
    • gradlew testDebug --tests="*MainActivityTest*" jacocoDebugReport