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.

Deprecated packages

SDK package Robolectric add-on package Javadoc Comment
com.google.android.gms:play-services org.robolectric:shadows-playservices Javadoc This package was deprecated in Robolectric 4.15
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
androidx.multidex.MultiDex org.robolectric:shadows-multidex Deprecated in Robolectric 4.14
Removed in Robolectric 4.15
com.android.support.multidex org.robolectric:shadows-multidex Deprecated in Robolectric 4.14
Removed in Robolectric 4.15
com.android.support.support-v4 org.robolectric:shadows-supportv4 Deprecated in Robolectric 4.8
Removed in Robolectric 4.9