Skip to content

Running Robolectric SNAPSHOT

utzcoz edited this page Nov 17, 2021 · 14 revisions
  1. Clone the robolectric repository: git clone --recurse-submodules https://github.com/robolectric/robolectric.
  2. Check out the branch/commit that you want to run.
  3. Run ./gradlew publishMavenJavaPublicationToMavenLocal in the Robolectric root directory. It is also faster to run SKIP_JAVADOC=true ./gradlew publishMavenJavaPublicationToMavenLocal. If you can't run it on Ubuntu 20.04 with icu building problem, you can export CC=gcc and export CXX=g++ at your terminal before running this command to fix building problem temporarily.
  4. Add mavenLocal() to your project's root project build.gradle:
    allprojects {
      repositories {
        mavenCentral()
        google()
        mavenLocal()
      }
    }
  5. Update your project to use the SNAPSHOT version of Roblectric (4.8-SNAPSHOT at time of writing).
    dependencies {
        ...
        testImplementation 'org.robolectric:robolectric:4.8-SNAPSHOT'
        ...
    }
  6. Run your project's tests.