Skip navigation links
  • Robolectric 4.15 | 
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Index
  • Help

Deprecated API

Contents

  • Packages
  • Interfaces
  • Classes
  • Fields
  • Methods
  • Constructors
  • Enum Constants
  • Annotation Type Elements
  • Deprecated Packages
    Package
    Description
    org.robolectric.shadows.gms
    This package is no longer maintained and will be removed in Robolectric 4.16.
    org.robolectric.shadows.httpclient
  • Deprecated Interfaces
    Interface
    Description
    org.robolectric.android.AttributeSetBuilder
    use Xml.asAttributeSet(XmlPullParser) instead. Not supported in ResourcesMode.Mode.NATIVE
    org.robolectric.Robolectric.AttributeSetBuilder
    Use Xml.asAttributeSet(XmlPullParser) instead.
  • Deprecated Classes
    Class
    Description
    org.robolectric.android.controller.FragmentController
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.android.util.concurrent.RoboExecutorService
    only works when used in conjunction with the deprecated LooperMode.Mode.LEGACY mode. Consider using guava's MoreExecutors.directExecutor() or PausedExecutorService or InlineExecutorService.
    org.robolectric.fakes.BaseCursor
    Use MatrixCursor instead.
    org.robolectric.fakes.RoboCursor
    Use MatrixCursor instead.
    org.robolectric.junit.rules.BackgroundTestRule
    use LooperMode.Mode.INSTRUMENTATION_TEST instead
    org.robolectric.MavenRoboSettings
    Don't put more stuff here.
    org.robolectric.RobolectricTestRunner.DeprecatedTestRunnerDefaultConfigProvider
    org.robolectric.shadows.gms.common.ShadowGoogleApiAvailability
    This package is no longer maintained and will be removed in Robolectric 4.16.
    org.robolectric.shadows.gms.ShadowGoogleAuthUtil
    This package is no longer maintained and will be removed in Robolectric 4.16.
    org.robolectric.shadows.gms.ShadowGooglePlayServicesUtil
    This package is no longer maintained and will be removed in Robolectric 4.16.
    org.robolectric.shadows.GnssStatusBuilder
    Use GnssStatus.Builder instead where possible.
    org.robolectric.shadows.ShadowAsyncTask
    AsyncTask is deprecated in the Android SDK.
    org.robolectric.shadows.ShadowAsyncTaskLoader
    AsyncTaskLoader is deprecated in the Android SDK.
    org.robolectric.shadows.ShadowCrossProfileApps.StartedMainActivity
    Use ShadowCrossProfileApps.peekNextStartedActivity() and ShadowCrossProfileApps.StartedActivity instead.
    org.robolectric.shadows.ShadowInputDevice
    use InputDeviceBuilder.
    org.robolectric.shadows.ShadowLegacyAsyncTask
    AsyncTask is deprecated in the Android SDK.
    org.robolectric.shadows.ShadowLegacyAsyncTaskLoader
    AsyncTaskLoader is deprecated in the Android SDK.
    org.robolectric.shadows.ShadowMimeTypeMap
    run on Android APIs >= S, which allows the real Android mime type data to be used
    org.robolectric.shadows.ShadowPausedAsyncTask
    AsyncTask is deprecated in the Android SDK.
    org.robolectric.shadows.ShadowPausedAsyncTaskLoader
    AsyncTaskLoader is deprecated in the Android SDK.
    org.robolectric.shadows.ShadowRangingResult
    Use RangingResultBuilder instead.
    org.robolectric.shadows.ShadowRangingResult.Builder
    Use RangingResultBuilder instead.
    org.robolectric.shadows.ShadowTelecomManager.CallRecord
    Use ShadowTelecomManager.IncomingCallRecord or ShadowTelecomManager.UnknownCallRecord instead.
    org.robolectric.util.Scheduler
    Scheduler APIs only function when using LooperMode.LEGACY. Switch to LooperMode.PAUSED and use ShadowLooper APIs instead.
  • Deprecated Fields
    Field
    Description
    org.robolectric.res.android.AConfiguration.ACONFIGURATION_ORIENTATION_SQUARE
    Not currently supported or used.
    org.robolectric.res.android.AConfiguration.ACONFIGURATION_TOUCHSCREEN_STYLUS
    Not currently supported or used.
    org.robolectric.RuntimeEnvironment.application
    Please use {#getApplication} instead. Accessing this field directly is inherently incompatible with LazyApplication and Robolectric makes no guarantees if a test *modifies* this field during execution.
    org.robolectric.RuntimeEnvironment.systemContext
    Use RuntimeEnvironment.getApplication() instead. Note that unlike the alternative, this field is inherently incompatible with LazyApplication. This field may be removed in a later release
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.allowWhileIdle
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.executor
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.handler
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.interval
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.onAlarmListener
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.operation
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.showIntent
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.triggerAtTime
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm.type
    org.robolectric.shadows.ShadowTelecomManager.CallRecord.bundle
    Use ShadowTelecomManager.CallRecord.extras instead.
    org.robolectric.shadows.ShadowUIModeManager.currentModeType
    Use ShadowUIModeManager.setCurrentModeType(int) or UiModeManager.getCurrentModeType() instead.
  • Deprecated Methods
    Method
    Description
    org.robolectric.android.controller.ActivityController.configurationChange(Configuration, DisplayMetrics, int)
    The config change should be calculated internally by the activity controller based on the previous configuration, use ActivityController.configurationChange(Configuration, DisplayMetrics) instead.
    org.robolectric.android.controller.ServiceController.withIntent(Intent)
    Use the appropriate builder in Robolectric instead.

    This method will be removed in Robolectric 3.6.

    org.robolectric.annotation.Config.assetDir()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure
    org.robolectric.annotation.Config.Builder.setAssetDir(String)
    Configure asset directory via your build system; see Build System Integration
    org.robolectric.annotation.Config.Builder.setLibraries(String...)
    Configure libraries via your build system; see Build System Integration
    org.robolectric.annotation.Config.Builder.setPackageName(String)
    Configure package name via your build system; see Build System Integration
    org.robolectric.annotation.Config.Builder.setResourceDir(String)
    Configure resource directory via your build system; see Build System Integration
    org.robolectric.annotation.Config.libraries()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure
    org.robolectric.annotation.Config.manifest()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure builds http://robolectric.org/getting-started/
    org.robolectric.annotation.Config.packageName()
    To change your package name please override the applicationId in your build system. Changing package name here is broken as the package name will no longer match the package name encoded in the arsc resources file. If you are looking to simulate another application you can create another applications Context using Context.createPackageContext(String, int). Note that you must add this package to ShadowPackageManager.addPackage(android.content.pm.PackageInfo) first.
    org.robolectric.annotation.Config.resourceDir()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure
    org.robolectric.annotation.Implements.looseSignatures()
    Use the ClassName annotation or the Implementation.methodName() annotation parameter instead.
    org.robolectric.res.android.NativeObjRegistry.getNativeObjectId(T)
    Use NativeObjRegistry.register(Object) instead.
    org.robolectric.res.android.NativeObjRegistry.unregister(T)
    Use NativeObjRegistry.unregister(long) instead.
    org.robolectric.Robolectric.buildAttributeSet()
    use Robolectric.getAttributeSetFromXml(int) instead
    org.robolectric.Robolectric.buildFragment(Class<T>)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.buildFragment(Class<T>, Intent)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.buildFragment(Class<T>, Intent, Bundle)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.buildFragment(Class<T>, Bundle)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.buildFragment(Class<T>, Class<? extends Activity>)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.buildFragment(Class<T>, Class<? extends Activity>, Intent)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.buildFragment(Class<T>, Class<? extends Activity>, Intent, Bundle)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.buildFragment(Class<T>, Class<? extends Activity>, Bundle)
    Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.
    org.robolectric.Robolectric.flushBackgroundThreadScheduler()
    The Scheduler APIs are designed for LEGACY Looper mode. Use ShadowLooper.runToEndOfTasks() instead.
    org.robolectric.Robolectric.flushForegroundThreadScheduler()
    The Scheduler APIs are designed for LEGACY Looper mode. Use ShadowLooper.runToEndOfTasks() instead.
    org.robolectric.Robolectric.getBackgroundThreadScheduler()
    The Scheduler APIs are designed for LEGACY Looper mode. It is strongly recommended to migrate tests to PAUSED Looper mode to avoid the need for this API.
    org.robolectric.Robolectric.getForegroundThreadScheduler()
    The Scheduler APIs are designed for LEGACY Looper mode. It is strongly recommended to migrate tests to PAUSED Looper mode to avoid the need for this API.
    org.robolectric.Robolectric.setupActivity(Class<T>)
    use androidx.test.core.app.ActivityScenario
    org.robolectric.RobolectricTestRunner.buildGlobalConfig()
    Provide a service implementation of GlobalConfigProvider instead. This method will be removed in Robolectric 4.3.
    org.robolectric.RobolectricTestRunner.createAndroidManifest(ManifestIdentifier)
    Do not use.
    org.robolectric.RuntimeEnvironment.getCompileTimeSystemResourcesPath()
    obsolete do not use
    org.robolectric.RuntimeEnvironment.getMasterScheduler()
    The Scheduler APIs are designed for LEGACY Looper mode. Prefer to migrate tests to PAUSED Looper mode to avoid the need for this API.
    org.robolectric.RuntimeEnvironment.setMasterScheduler(Scheduler)
    The Scheduler APIs are designed for LEGACY Looper mode. Prefer to migrate tests to PAUSED Looper mode to avoid the need for this API.
    org.robolectric.shadows.gms.Shadows.shadowOf(GoogleAuthUtil)
    org.robolectric.shadows.gms.Shadows.shadowOf(GoogleApiAvailability)
    org.robolectric.shadows.gms.Shadows.shadowOf(GooglePlayServicesUtil)
    org.robolectric.shadows.httpclient.FakeHttp.addPendingHttpResponseWithContentType(int, String, Header)
    use FakeHttp.addPendingHttpResponse(int, String, org.apache.http.Header...) instead
    org.robolectric.shadows.httpclient.ShadowDefaultRequestDirector.getSentHttpRequest(int)
    Use FakeHttp.getSentHttpRequestInfo(int) instead. This method will be removed in Robolectric 4.13.
    org.robolectric.shadows.httpclient.ShadowDefaultRequestDirector.getSentHttpRequestInfo(int)
    Use FakeHttp.getSentHttpRequest(int) instead. This method will be removed in Robolectric 4.13.
    org.robolectric.shadows.ShadowActivity.callOnActivityResult(int, int, Intent)
    org.robolectric.shadows.ShadowActivity.isLockTask()
    Use ActivityManager.getLockTaskModeState() instead.
    org.robolectric.shadows.ShadowActivity.setLastNonConfigurationInstance(Object)
    use ActivityController.recreate().
    org.robolectric.shadows.ShadowActivityManager.addApplicationExitInfo(String, int, int, int)
    Prefer using overload with ShadowActivityManager.ApplicationExitInfoBuilder
    org.robolectric.shadows.ShadowActivityThread.setApplicationInfo(ApplicationInfo)
    do not use
    org.robolectric.shadows.ShadowAlarmManager.getNextScheduledAlarm()
    Prefer to use ShadowAlarmManager.setAutoSchedule(boolean) in combination with incrementing time to actually run alarms and test their side-effects.
    org.robolectric.shadows.ShadowApplication.getBackgroundThreadScheduler()
    use Robolectric.getBackgroundThreadScheduler()
    org.robolectric.shadows.ShadowApplication.getLatestAlertDialog()
    Use ShadowAlertDialog.getLatestAlertDialog() instead.
    org.robolectric.shadows.ShadowApplication.getLatestDialog()
    Use ShadowDialog.getLatestDialog() instead.
    org.robolectric.shadows.ShadowApplication.getLatestPopupMenu()
    Use ShadowPopupMenu.getLatestPopupMenu() instead.
    org.robolectric.shadows.ShadowApplication.getReceiversForIntent(Intent)
    use PackageManager.queryBroadcastReceivers instead
    org.robolectric.shadows.ShadowApplication.hasReceiverForIntent(Intent)
    use PackageManager.queryBroadcastReceivers instead
    org.robolectric.shadows.ShadowApplication.runBackgroundTasks()
    This is only for LEGACY Looper mode. Use PAUSED Looper mode instead.
    org.robolectric.shadows.ShadowApplication.setSystemService(String, Object)
    Do not depend on this method to override services as it will be removed in a future update. The preferred method is use the shadow of the corresponding service.
    org.robolectric.shadows.ShadowAppOpsManager.checkOpNoThrow(String, int, String)
    org.robolectric.shadows.ShadowAppWidgetManager.putWidgetInfo(int, AppWidgetProviderInfo)
    org.robolectric.shadows.ShadowAssetManager.ArscBase.getCompileTimeResTable()
    Avoid use.
    org.robolectric.shadows.ShadowAudioRecord.setSource(ShadowAudioRecord.AudioRecordSource)
    use ShadowAudioRecord.setSourceProvider(AudioRecordSourceProvider).
    org.robolectric.shadows.ShadowBitmapDrawable.getCreatedFromResId()
    use ShadowBitmap#getCreatedFromResId() instead.
    org.robolectric.shadows.ShadowBitmapFactory.provideWidthAndHeightHints(int, int, int)
    Use any of the BitmapFactory.decode methods with real image data.
    org.robolectric.shadows.ShadowBitmapFactory.provideWidthAndHeightHints(Uri, int, int)
    Use any of the BitmapFactory.decode methods with real image data.
    org.robolectric.shadows.ShadowBitmapFactory.provideWidthAndHeightHints(FileDescriptor, int, int)
    Use any of the BitmapFactory.decode methods with real image data.
    org.robolectric.shadows.ShadowBitmapFactory.provideWidthAndHeightHints(String, int, int)
    Use any of the BitmapFactory.decode methods with real image data.
    org.robolectric.shadows.ShadowBluetoothAdapter.setBluetoothLeAdvertiser(BluetoothLeAdvertiser)
    use real BluetoothLeAdvertiser instead
    org.robolectric.shadows.ShadowBluetoothDevice.newInstance(String)
    org.robolectric.shadows.ShadowChoreographer.getFrameInterval()
    Use the LooperMode.Mode.PAUSED looper and ShadowChoreographer.getFrameDelay() to configure the frame delay.
    org.robolectric.shadows.ShadowChoreographer.getNextVsyncTime()
    use ShadowChoreographer.getNextVsyncTimeNanos() instead
    org.robolectric.shadows.ShadowChoreographer.setFrameInterval(long)
    Use the LooperMode.Mode.PAUSED looper and ShadowChoreographer.setFrameDelay(Duration) to configure the frame delay.
    org.robolectric.shadows.ShadowChoreographer.setPostCallbackDelay(int)
    Use the LooperMode.Mode.PAUSED looper instead.
    org.robolectric.shadows.ShadowChoreographer.setPostFrameCallbackDelay(int)
    Use the LooperMode.Mode.PAUSED looper and ShadowChoreographer.setPaused(boolean) and ShadowChoreographer.setFrameDelay(Duration) to configure the vsync event behavior.
    org.robolectric.shadows.ShadowContentProviderOperation.getContentValues()
    implementation detail - use public Android APIs instead
    org.robolectric.shadows.ShadowContentProviderOperation.getExpectedCount()
    implementation detail - use public Android APIs instead
    org.robolectric.shadows.ShadowContentProviderOperation.getSelection()
    implementation detail - use public Android APIs instead
    org.robolectric.shadows.ShadowContentProviderOperation.getSelectionArgs()
    implementation detail - use public Android APIs instead
    org.robolectric.shadows.ShadowContentProviderOperation.getSelectionArgsBackReferences()
    implementation detail - use public Android APIs instead
    org.robolectric.shadows.ShadowContentProviderOperation.getType()
    implementation detail - use public Android APIs instead
    org.robolectric.shadows.ShadowContentProviderOperation.getValuesBackReferences()
    implementation detail - use public Android APIs instead
    org.robolectric.shadows.ShadowContentResolver.getContentProviderOperations(String)
    Use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor instead.
    org.robolectric.shadows.ShadowContentResolver.getDeletedUris()
    Use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor instead.
    org.robolectric.shadows.ShadowContentResolver.getDeleteStatements()
    Use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor instead.
    org.robolectric.shadows.ShadowContentResolver.getInsertStatements()
    This method does not work with ContentResolver.acquireContentProviderClient(android.net.Uri). Instead, use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor.
    org.robolectric.shadows.ShadowContentResolver.getNotifiedUris()
    Use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor instead.
    org.robolectric.shadows.ShadowContentResolver.getStatements()
    This method does not work with ContentResolver.acquireContentProviderClient(android.net.Uri). Instead, use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor.
    org.robolectric.shadows.ShadowContentResolver.getUpdateStatements()
    This method does not work with ContentResolver.acquireContentProviderClient(android.net.Uri). Instead, use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor.
    org.robolectric.shadows.ShadowContentResolver.notifyChange(Uri, ContentObserver, boolean)
    Use ShadowContentResolver.notifyChange(Uri, ContentObserver, int) instead.
    org.robolectric.shadows.ShadowContentResolver.setCursor(Uri, BaseCursor)
    This method does not work with ContentResolver.acquireContentProviderClient(android.net.Uri). Instead, use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor.
    org.robolectric.shadows.ShadowContentResolver.setCursor(BaseCursor)
    This method affects all calls, and does not work with ContentResolver.acquireContentProviderClient(android.net.Uri). Instead, use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor.
    org.robolectric.shadows.ShadowContentResolver.setNextDatabaseIdForInserts(int)
    This method affects all calls, and does not work with ContentResolver.acquireContentProviderClient(android.net.Uri). Instead, use Robolectric.setupContentProvider(Class, String) to install a test-specific ContentProvider that can return any Cursor.
    org.robolectric.shadows.ShadowCrossProfileApps.peekNextStartedMainActivity()
    Use ShadowCrossProfileApps.peekNextStartedActivity() instead.
    org.robolectric.shadows.ShadowDisplay.getMetrics(DisplayMetrics)
    This behavior is deprecated and will be removed in Robolectric 4.13.
    org.robolectric.shadows.ShadowDisplay.getRealMetrics(DisplayMetrics)
    This behavior is deprecated and will be removed in Robolectric 4.13.
    org.robolectric.shadows.ShadowDisplay.getRefreshRate()
    This behavior is deprecated and will be removed in Robolectric 3.7.
    org.robolectric.shadows.ShadowDisplay.setScaledDensity(float)
    This method is deprecated and will be removed in Robolectric 4.13.
    org.robolectric.shadows.ShadowDrawable.createFromResourceId(int)
    use ContextCompat.getDrawable(context, resourceId)
    org.robolectric.shadows.ShadowFingerprintManager.setHasEnrolledFingerprints(boolean)
    use ShadowFingerprintManager.setDefaultFingerprints(int) instead.
    org.robolectric.shadows.ShadowInCallService.addCall(Call)
    Please add calls by adding a Call using InCallService.InCallServiceBinder.
    org.robolectric.shadows.ShadowInCallService.removeCall(Call)
    Please remove calls by invoking Call.disconnect().
    org.robolectric.shadows.ShadowInputDevice.makeInputDeviceNamed(String)
    use InputDeviceBuilder.
    org.robolectric.shadows.ShadowInputDevice.setDeviceName(String)
    use InputDeviceBuilder.
    org.robolectric.shadows.ShadowInputDevice.setProductId(int)
    use InputDeviceBuilder.
    org.robolectric.shadows.ShadowInputDevice.setVendorId(int)
    use InputDeviceBuilder.
    org.robolectric.shadows.ShadowKeyguardManager.setinRestrictedInputMode(boolean)
    use ShadowKeyguardManager.setInRestrictedInputMode(boolean) instead
    org.robolectric.shadows.ShadowLegacyLooper.post(Runnable, long)
    Use a Handler instance to post to a looper.
    org.robolectric.shadows.ShadowLegacyLooper.postAtFrontOfQueue(Runnable)
    Use a Handler instance to post to a looper.
    org.robolectric.shadows.ShadowLocationManager.getLocationUpdateListeners()
    Do not test listeners, instead use ShadowLocationManager.simulateLocation(Location) and test the results of those listeners being invoked.
    org.robolectric.shadows.ShadowLocationManager.getLocationUpdateListeners(String)
    Do not test listeners, instead use ShadowLocationManager.simulateLocation(Location) and test the results of those listeners being invoked.
    org.robolectric.shadows.ShadowLocationManager.getLocationUpdatePendingIntents()
    Do not test pending intents, instead use ShadowLocationManager.simulateLocation(Location) and test the results of those pending intent being invoked.
    org.robolectric.shadows.ShadowLocationManager.getLocationUpdatePendingIntents(String)
    Do not test pending intents, instead use ShadowLocationManager.simulateLocation(Location) and test the results of those pending intent being invoked.
    org.robolectric.shadows.ShadowLocationManager.getRequestLocationUpdateListeners()
    Do not test listeners, instead use ShadowLocationManager.simulateLocation(Location) and test the results of those listeners being invoked.
    org.robolectric.shadows.ShadowLocationManager.sendGnssAntennaInfo(List<GnssAntennaInfo>)
    Use ShadowLocationManager.simulateGnssAntennaInfo(List) instead.
    org.robolectric.shadows.ShadowLocationManager.sendGnssMeasurementsEvent(GnssMeasurementsEvent)
    Use ShadowLocationManager.simulateGnssMeasurementsEvent(GnssMeasurementsEvent) instead.
    org.robolectric.shadows.ShadowLocationManager.sendGnssStatus(GnssStatus)
    Use ShadowLocationManager.simulateGnssStatus(GnssStatus) instead.
    org.robolectric.shadows.ShadowLocationManager.sendNmeaMessage(String, long)
    Use ShadowLocationManager.simulateNmeaMessage(String, long) instead.
    org.robolectric.shadows.ShadowLocationManager.setLastKnownLocation(String, Location)
    Use ShadowLocationManager.simulateLocation(Location) to update the last location for a provider.
    org.robolectric.shadows.ShadowLooper.getShadowMainLooper()
    Use shadowOf({@link Looper#getMainLooper()}) instead.
    org.robolectric.shadows.ShadowLooper.idle(long)
    Use ShadowLooper.idleFor(Duration).
    org.robolectric.shadows.ShadowLooper.idle(long, TimeUnit)
    use ShadowLooper.idleFor(long, TimeUnit)
    org.robolectric.shadows.ShadowLooper.idleMainLooper(long)
    Use ShadowLooper.idleMainLooper(long, TimeUnit).
    org.robolectric.shadows.ShadowLooper.post(Runnable, long)
    Use a Handler instance to post to a looper.
    org.robolectric.shadows.ShadowLooper.postAtFrontOfQueue(Runnable)
    Use a Handler instance to post to a looper.
    org.robolectric.shadows.ShadowMotionEvent.setPointer2(float, float)
    use MotionEvent.obtain() or androidx.test.core.view.MotionEventBuilder to create a MotionEvent with desired data.
    org.robolectric.shadows.ShadowMotionEvent.setPointerIds(int, int)
    use MotionEvent.obtain() or MotionEventBuilder to create a MotionEvent with desired data
    org.robolectric.shadows.ShadowMotionEvent.setPointerIndex(int)
    use MotionEvent.obtain() or androidx.test.core.view.MotionEventBuilder#setPointerAction(int, int) to create a MotionEvent with desired data.
    org.robolectric.shadows.ShadowNetworkInfo.newInstance(NetworkInfo.DetailedState, int, int, boolean, boolean)
    use ShadowNetworkInfo.newInstance(NetworkInfo.DetailedState, int, int, boolean, NetworkInfo.State) instead
    org.robolectric.shadows.ShadowNetworkInfo.setConnectionStatus(boolean)
    use ShadowNetworkInfo.setConnectionStatus(NetworkInfo.State) instead
    org.robolectric.Shadows.shadowOf(RangingResult)
    org.robolectric.Shadows.shadowOf(InputDevice)
    org.robolectric.Shadows.shadowOf(MimeTypeMap)
    org.robolectric.shadows.ShadowPackageInstaller.setSessionSucceeds(int)
    org.robolectric.shadows.ShadowPackageManager.addPackage(PackageInfo)
    Use ShadowPackageManager.installPackage(android.content.pm.PackageInfo) instead.
    org.robolectric.shadows.ShadowPackageManager.addPackage(String)
    Use ShadowPackageManager.installPackage(PackageInfo) instead.
    org.robolectric.shadows.ShadowPackageManager.addResolveInfoForIntent(Intent, ResolveInfo)
    use ShadowPackageManager.addIntentFilterForComponent(android.content.ComponentName, android.content.IntentFilter, java.util.Map<android.content.ComponentName, java.util.List<android.content.IntentFilter>>) instead and if the component doesn't exist add it using any of ShadowPackageManager.installPackage(android.content.pm.PackageInfo), ShadowPackageManager.addOrUpdateActivity(android.content.pm.ActivityInfo), ShadowPackageManager.addActivityIfNotPresent(android.content.ComponentName) or their counterparts for other types of components.
    org.robolectric.shadows.ShadowPackageManager.addResolveInfoForIntent(Intent, List<ResolveInfo>)
    see note on ShadowPackageManager.addResolveInfoForIntent(Intent, ResolveInfo).
    org.robolectric.shadows.ShadowPackageManager.addResolveInfoForIntentNoDefaults(Intent, ResolveInfo)
    see the note on ShadowPackageManager.addResolveInfoForIntent(Intent, ResolveInfo).
    org.robolectric.shadows.ShadowPackageManager.removeResolveInfosForIntent(Intent, String)
    see note on ShadowPackageManager.addResolveInfoForIntent(Intent, ResolveInfo).
    org.robolectric.shadows.ShadowPackageManager.setResolveInfosForIntent(Intent, List<ResolveInfo>)
    see the note on ShadowPackageManager.addResolveInfoForIntent(Intent, ResolveInfo).
    org.robolectric.shadows.ShadowPausedAsyncTaskLoader.setExecutor(Executor)
    It is recommended to switch to androidx's AsyncTaskLoader, which provides an overridable getExecutor method.
    org.robolectric.shadows.ShadowPausedLooper.setIgnoreUncaughtExceptions(boolean)
    this method only exists to accommodate legacy tests with preexisting issues. Silently discarding exceptions is not recommended, and can lead to deadlocks.
    org.robolectric.shadows.ShadowPendingIntent.isActivityIntent()
    prefer ShadowPendingIntent.isActivity() which was added to PendingIntent in API 31 (Android S).
    org.robolectric.shadows.ShadowPendingIntent.isBroadcastIntent()
    prefer ShadowPendingIntent.isBroadcast() which was added to PendingIntent in API 31 (Android S).
    org.robolectric.shadows.ShadowPendingIntent.isForegroundServiceIntent()
    prefer ShadowPendingIntent.isForegroundService() which was added to PendingIntent in API 31 (Android S).
    org.robolectric.shadows.ShadowPendingIntent.isServiceIntent()
    prefer ShadowPendingIntent.isService() which was added to PendingIntent in API 31 (Android S).
    org.robolectric.shadows.ShadowPowerManager.setIsInteractive(boolean)
    Prefer ShadowPowerManager.turnScreenOn(boolean) instead.
    org.robolectric.shadows.ShadowPowerManager.setIsScreenOn(boolean)
    Use ShadowPowerManager.turnScreenOn(boolean) instead.
    org.robolectric.shadows.ShadowRoleManager.addAvailableRole(String)
    - Please use ShadowRoleManager.addRoleHolder(java.lang.String, java.lang.String, android.os.UserHandle)
    org.robolectric.shadows.ShadowRoleManager.addHeldRole(String)
    - Please use ShadowRoleManager.addRoleHolder(java.lang.String, java.lang.String, android.os.UserHandle)
    org.robolectric.shadows.ShadowRoleManager.removeAvailableRole(String)
    - Please use ShadowRoleManager.removeRoleHolder(java.lang.String, java.lang.String, android.os.UserHandle)
    org.robolectric.shadows.ShadowRoleManager.removeHeldRole(String)
    - Please use ShadowRoleManager.removeRoleHolder(java.lang.String, java.lang.String, android.os.UserHandle)
    org.robolectric.shadows.ShadowScanResult.newInstance(String, String, String, int, int)
    use ScanResult() instead
    org.robolectric.shadows.ShadowScanResult.newInstance(String, String, String, int, int, boolean)
    use ScanResult() instead
    org.robolectric.shadows.ShadowSensorManager.addSensor(int, Sensor)
    Use ShadowSensor.newInstance(int) to construct your Sensor and add to the SensorManager using ShadowSensorManager.addSensor(Sensor) instead. This method will be removed at some point allowing us to use more of the real SensorManager code.
    org.robolectric.shadows.ShadowSensorManager.createSensorEvent()
    Use {@link SensorEventBuilder#newBuilder()} instead.
    org.robolectric.shadows.ShadowSensorManager.createSensorEvent(int)
    Use {@link SensorEventBuilder#newBuilder()} instead.
    org.robolectric.shadows.ShadowSensorManager.createSensorEvent(int, int)
    Use {@link SensorEventBuilder#newBuilder()} instead.
    org.robolectric.shadows.ShadowSystemClock.nanoTime()
    Don't call this method directly; instead, use System.nanoTime().
    org.robolectric.shadows.ShadowTelecomManager.clearAccounts()
     
    org.robolectric.shadows.ShadowTelecomManager.getDefaultPhoneApp()
     
    org.robolectric.shadows.ShadowTelecomManager.setDefaultDialer(String)
    API deprecated since Q, for testing, use setDefaultDialerPackage instead
    org.robolectric.shadows.ShadowTelephonyManager.getEventFlags()
    Avoid using.
    org.robolectric.shadows.ShadowTelephonyManager.getListener()
    Avoid using.
    org.robolectric.shadows.ShadowTelephonyManager.resetSimCountryIsos()
    for resetAllSimCountryIsos
    org.robolectric.shadows.ShadowTelephonyManager.resetSimStates()
    use resetAllSimStates()
    org.robolectric.shadows.ShadowTelephonyManager.setNetworkType(int)
    TelephonyManager.getNetworkType() was replaced with TelephonyManager.getDataNetworkType() in Android N, and has been deprecated in Android R. Use instead.
    org.robolectric.shadows.ShadowUsageStatsManager.addEvent(String, long, int)
    Use ShadowUsageStatsManager.addEvent(Event) and ShadowUsageStatsManager.EventBuilder instead.
    org.robolectric.shadows.ShadowUsbDeviceConnection.readOutgoingData(byte[])
    prefer ShadowUsbDeviceConnection.getOutgoingDataStream(), which allows callers to know how much data has been read and when the UsbDeviceConnection closes.
    org.robolectric.shadows.ShadowUserManager.addUserProfile(UserHandle)
    use either addUser() or addProfile()
    org.robolectric.shadows.ShadowUserManager.setCanSwitchUser(boolean)
    use ShadowUserManager.setUserSwitchability(int) instead
    org.robolectric.shadows.ShadowUserManager.setIsDemoUser(boolean)
    Use ShadowUserManager.addUser(int, String, int) to create a demo user instead of changing default user flags.
    org.robolectric.shadows.ShadowUserManager.setIsGuestUser(boolean)
    Use ShadowUserManager.addUser(int, String, int) to create a guest user instead of changing default user flags.
    org.robolectric.shadows.ShadowUserManager.setIsLinkedUser(boolean)
    Use ShadowUserManager.addUser(int, String, int) to create a linked user instead of changing default user flags.
    org.robolectric.shadows.ShadowUserManager.setIsPrimaryUser(boolean)
    Use ShadowUserManager.addUser(int, String, int) to create a primary user instead of changing default user flags.
    org.robolectric.shadows.ShadowUserManager.setIsRestrictedProfile(boolean)
    use ShadowUserManager.addUser(int, String, int) instead
    org.robolectric.shadows.ShadowUserManager.setIsSystemUser(boolean)
    Use ShadowUserManager.addUser(int, String, int) to create a system user instead of changing default user flags.
    org.robolectric.shadows.ShadowUserManager.setUserRestriction(UserHandle, String, boolean)
    When possible, please use the real Android framework API UserManager#setUserRestriction().
    org.robolectric.shadows.ShadowView.checkedPerformClick()
    - Please use Espresso for View interactions.
    org.robolectric.shadows.ShadowView.clickOn(View)
    Please use Espresso for view interactions
    org.robolectric.shadows.ShadowView.dump()
    - Please use androidx.test.espresso.util.HumanReadables#describe(View)
    org.robolectric.shadows.ShadowView.dump(View)
    - Please use androidx.test.espresso.util.HumanReadables#describe(View)
    org.robolectric.shadows.ShadowView.dump(PrintStream, int)
    - Please use androidx.test.espresso.util.HumanReadables#describe(View)
    org.robolectric.shadows.ShadowView.dumpAttribute(PrintStream, String, String)
    org.robolectric.shadows.ShadowView.dumpAttributes(PrintStream)
    org.robolectric.shadows.ShadowView.dumpFirstPart(PrintStream, int)
    org.robolectric.shadows.ShadowView.dumpIndent(PrintStream, int)
    org.robolectric.shadows.ShadowViewGroup.dump(PrintStream, int)
    - Please use androidx.test.espresso.util.HumanReadables#describe(View)
    org.robolectric.shadows.ShadowWebView.setCanGoBack(boolean)
    Do not depend on this method as it will be removed in a future update. The preferred method is to populate a fake web history to use for going back.
    org.robolectric.shadows.UiccCardInfoBuilder.setIccId(String)
    This is no longer set on T+ due to MEP as a single eUICC can have more than one ICCID tied to it. It is instead set via UiccPortInfo.
    org.robolectric.shadows.UiccCardInfoBuilder.setSlotIndex(int)
    Use UiccCardInfoBuilder.setPhysicalSlotIndex(int) for Android T+ instead.
    org.robolectric.util.Scheduler.advanceBy(long)
    Use Scheduler.advanceBy(long, TimeUnit).
  • Deprecated Constructors
    Constructor
    Description
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm(int, long, long, PendingIntent, PendingIntent)
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm(int, long, long, PendingIntent, PendingIntent, boolean)
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm(int, long, PendingIntent, PendingIntent)
  • Deprecated Enum Constants
    Enum Constant
    Description
    org.robolectric.annotation.LooperMode.Mode.LEGACY
    use LooperMode.PAUSED
    org.robolectric.annotation.SQLiteMode.Mode.LEGACY
    This mode is obsolete and will be removed soon.
    org.robolectric.annotation.TextLayoutMode.Mode.LEGACY
    LEGACY mode is inaccurate, has known bugs and will be removed in a future release.
    org.robolectric.annotation.TextLayoutMode.Mode.REALISTIC
    REALISTIC is the default mode and does not need to be stated explicitly.
  • Deprecated Annotation Type Elements
    Annotation Type Element
    Description
    org.robolectric.annotation.Config.assetDir()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure
    org.robolectric.annotation.Config.libraries()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure
    org.robolectric.annotation.Config.manifest()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure builds http://robolectric.org/getting-started/
    org.robolectric.annotation.Config.packageName()
    To change your package name please override the applicationId in your build system. Changing package name here is broken as the package name will no longer match the package name encoded in the arsc resources file. If you are looking to simulate another application you can create another applications Context using Context.createPackageContext(String, int). Note that you must add this package to ShadowPackageManager.addPackage(android.content.pm.PackageInfo) first.
    org.robolectric.annotation.Config.resourceDir()
    If you are using at least Android Studio 3.0 alpha 5 or Bazel's android_local_test please migrate to the preferred way to configure
    org.robolectric.annotation.Implements.looseSignatures()
    Use the ClassName annotation or the Implementation.methodName() annotation parameter instead.