Skip to content

Using add-on modules

In order to reduce the number of external dependencies on the application being tested, Robolectric's shadows are split into various add-on packages. Only shadows for classes provided in the base Android SDK are provided by the main Robolectric module. Additional shadows are provided in dedicated packages.

Note

  • Robolectric 3.4 doesn't include the shadows- prefix in the package name (i.e., org.robolectric:playservices and org.robolectric:httpclient).
  • Before Robolectric 3.4, org.robolectric:playservices was named shadow-play-services.

Supported packages

SDK package Robolectric add-on package Javadoc
com.google.android.gms:play-services org.robolectric:shadows-playservices Javadoc

Deprecated packages

SDK package Robolectric add-on package Javadoc Comment
androidx.multidex.MultiDex org.robolectric:shadows-multidex Javadoc This package was deprecated in Robolectric 4.14.
com.android.support.multidex org.robolectric:shadows-multidex Javadoc This package was deprecated in Robolectric 4.14.
org.apache.httpcomponents:httpclient org.robolectric:shadows-httpclient Javadoc These shadows are only provided for legacy compatibility.

Removed packages

SDK package Robolectric add-on package Comment
com.android.support.support-v4 org.robolectric:shadows-supportv4 This package was deprecated in Robolectric 4.8, and removed in Robolectric 4.9.