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

Deprecated API

Contents

  • Packages
  • Interfaces
  • Classes
  • Fields
  • Methods
  • Constructors
  • Enum Constants
  • Annotation Type Elements
  • Packages 
    Package Description
    org.robolectric.shadows.httpclient
  • Interfaces 
    Interface Description
    org.robolectric.res.FsFile
    Use Path instead.
    org.robolectric.Robolectric.AttributeSetBuilder
    Use AttributeSetBuilder instead.
  • 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.LEGACY mode. Consider using guava's MoreExecutors#directExecutor() or PausedExecutorService or InlineExecutorService.
    org.robolectric.ConfigMerger
    Provide an implementation of Provider. This class will be removed in Robolectric 4.3.
    org.robolectric.fakes.BaseCursor
    Use MatrixCursor instead.
    org.robolectric.fakes.RoboCursor
    Use MatrixCursor instead.
    org.robolectric.internal.bytecode.InvokeDynamicClassInstrumentor
    The invoke-dynamic case has been moved to ClassInstrumentor. Classes previously extending this class should extend ClassInstrumentor directly.
    org.robolectric.internal.bytecode.ProxyMaker
    This is incompatible with JDK17+. Use a Reflector interface with Direct.
    org.robolectric.internal.MavenManifestFactory
    This method of configuration will be removed in a forthcoming release. Build systems should follow http://robolectric.org/build-system-integration/ to provide integration with Robolectric.
    org.robolectric.MavenRoboSettings
    Don't put more stuff here.
    org.robolectric.RobolectricTestRunner.DeprecatedTestRunnerDefaultConfigProvider
    org.robolectric.RoboSettings
    Don't put more stuff here.
    org.robolectric.SdkPicker
    use DefaultSdkPicker instead.
    org.robolectric.shadows.GnssStatusBuilder
    Use GnssStatus.Builder instead where possible.
    org.robolectric.shadows.ShadowCrossProfileApps.StartedMainActivity
    Use ShadowCrossProfileApps.peekNextStartedActivity() and ShadowCrossProfileApps.StartedActivity instead.
    org.robolectric.shadows.ShadowTelecomManager.CallRecord
    Use ShadowTelecomManager.IncomingCallRecord or ShadowTelecomManager.UnknownCallRecord instead.
    org.robolectric.util.FragmentTestUtil
    Please use Robolectric.buildFragment(Class) instead. This will be removed in a forthcoming release,
    org.robolectric.util.SimpleFuture
    This class can introduce deadlocks, since its lock is held while invoking run().
  • 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.
  • Methods 
    Method Description
    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.android.internal.LooperDelegatingScheduler.idleConstantly​(boolean)
    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.internal.bytecode.ShadowImpl.directlyOn​(T, Class<T>)
    This is incompatible with JDK17+. Use a Reflector interface with Direct.
    org.robolectric.internal.bytecode.ShadowMap.convertToShadowName​(String)
    do not use
    org.robolectric.internal.dependency.DependencyResolver.getLocalArtifactUrls​(DependencyJar)
    Robolectric will never ask for a dependency composed of more than one artifact, so this method isn't necessary.
    org.robolectric.internal.IShadow.directlyOn​(T, Class<T>)
    This is incompatible with JDK17+. Use a Reflector interface with Direct.
    org.robolectric.manifest.AndroidManifest.supportsBinaryResourcesMode()
    Do not use.
    org.robolectric.manifest.AndroidManifest.supportsLegacyResourcesMode()
    Do not use.
    org.robolectric.manifest.PackageItemData.getClassName()
    - Use PackageItemData.getName() 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.res.Fs.fileFromPath​(String)
    Use Fs.fromUrl(String) instead.
    org.robolectric.res.Fs.newFile​(File)
    Use File.toPath() instead.
    org.robolectric.res.FsFile.getPath()
    use Fs.externalize(Path) instead.
    org.robolectric.res.FsFile.join​(String)
    use Path.resolve(Path) instead.
    org.robolectric.res.Qualifiers.addPlatformVersion​(String, int)
    Figure something else out.
    org.robolectric.res.Qualifiers.addScreenWidth​(String, int)
    Use Configuration.screenWidthDp instead.
    org.robolectric.res.Qualifiers.addSmallestScreenWidth​(String, int)
    Use Configuration.smallestScreenWidthDp instead.
    org.robolectric.res.Qualifiers.getOrientation​(String)
    Use Configuration.orientation instead.
    org.robolectric.res.Qualifiers.getPlatformVersion​(String)
    Use Build.VERSION.SDK_INT instead.
    org.robolectric.res.Qualifiers.getScreenWidth​(String)
    Use Configuration.screenWidthDp instead.
    org.robolectric.res.Qualifiers.getSmallestScreenWidth​(String)
    Use Configuration.smallestScreenWidthDp 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.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.RobolectricTestRunner.getConfig​(Method)
    Provide an implementation of Provider instead. This method will be removed in Robolectric 4.3.
    org.robolectric.RuntimeEnvironment.setUseLegacyResources​(boolean)
    Do not use.
    org.robolectric.RuntimeEnvironment.useLegacyResources()
    Do not use.
    org.robolectric.shadow.api.Shadow.directlyOn​(T, Class<T>)
    This is incompatible with JDK17+. Use a Reflector interface with Direct.
    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.)
    org.robolectric.shadows.httpclient.ShadowDefaultRequestDirector.getSentHttpRequestInfo​(int)
    Use FakeHttp.getSentHttpRequest(int) instead.)
    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.addWakeLock​(PowerManager.WakeLock)
    use PowerManager APIs instead
    org.robolectric.shadows.ShadowApplication.clearWakeLocks()
    use ShadowPowerManager.clearWakeLocks
    org.robolectric.shadows.ShadowApplication.getAppWidgetManager()
    Please use Context#getSystemService(Context.APPWIDGET_SERVICE) intstead.
    org.robolectric.shadows.ShadowApplication.getBackgroundThreadScheduler()
    use Robolectric.getBackgroundThreadScheduler()
    org.robolectric.shadows.ShadowApplication.getBluetoothAdapter()
    Use BluetoothAdapter.getDefaultAdapter() ()} instead.
    org.robolectric.shadows.ShadowApplication.getForegroundThreadScheduler()
    use Robolectric.getForegroundThreadScheduler()
    org.robolectric.shadows.ShadowApplication.getInstance()
    Use shadowOf({@link ApplicationProvider#getApplicationContext()}) instead.
    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.getLatestWakeLock()
    use ShadowPowerManager.getLatestWakeLock
    org.robolectric.shadows.ShadowApplication.getReceiversForIntent​(Intent)
    use PackageManager.queryBroadcastReceivers instead
    org.robolectric.shadows.ShadowApplication.hasReceiverForIntent​(Intent)
    use PackageManager.queryBroadcastReceivers 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 preferered 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.ShadowAssetManager.useLegacy()
    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​(Uri, 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.ShadowBluetoothAdapter.setEnabled​(boolean)
    Use BluetoothAdapter.enable() or BluetoothAdapter.disable().
    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.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)
    org.robolectric.shadows.ShadowContentResolver.getDeletedUris()
    org.robolectric.shadows.ShadowContentResolver.getDeleteStatements()
    org.robolectric.shadows.ShadowContentResolver.getInsertStatements()
    This method does not work with ContentResolver.acquireContentProviderClient(android.net.Uri)
    org.robolectric.shadows.ShadowContentResolver.getNotifiedUris()
    org.robolectric.shadows.ShadowContentResolver.getStatements()
    This method does not work with ContentResolver.acquireContentProviderClient(android.net.Uri)
    org.robolectric.shadows.ShadowContentResolver.getUpdateStatements()
    This method does not work with ContentResolver.acquireContentProviderClient(android.net.Uri)
    org.robolectric.shadows.ShadowContentResolver.setContentProviderResult​(ContentProviderResult[])
    org.robolectric.shadows.ShadowContentResolver.setCursor​(BaseCursor)
    This method affects all calls, and does not work with ContentResolver.acquireContentProviderClient(android.net.Uri)
    org.robolectric.shadows.ShadowContentResolver.setNextDatabaseIdForInserts​(int)
    This method affects all calls, and does not work with ContentResolver.acquireContentProviderClient(android.net.Uri)
    org.robolectric.shadows.ShadowCrossProfileApps.peekNextStartedMainActivity()
    Use ShadowCrossProfileApps.peekNextStartedActivity() instead.
    org.robolectric.shadows.ShadowDisplay.getDisplayId()
    This behavior is deprecated and will be removed in Robolectric 3.7.
    org.robolectric.shadows.ShadowDisplay.getMetrics​(DisplayMetrics)
    This behavior is deprecated and will be removed in Robolectric 3.7.
    org.robolectric.shadows.ShadowDisplay.getPixelFormat()
    This behavior is deprecated and will be removed in Robolectric 3.7.
    org.robolectric.shadows.ShadowDisplay.getRealMetrics​(DisplayMetrics)
    This behavior is deprecated and will be removed in Robolectric 3.7.
    org.robolectric.shadows.ShadowDisplay.getRefreshRate()
    This behavior is deprecated and will be removed in Robolectric 3.7.
    org.robolectric.shadows.ShadowDisplay.setDisplayId​(int)
    This method is deprecated and will be removed in Robolectric 3.7.
    org.robolectric.shadows.ShadowDisplay.setPixelFormat​(int)
    This method 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 3.7.
    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.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.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.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.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.ShadowPackageInstaller.setSessionSucceeds​(int)
    org.robolectric.shadows.ShadowPackageManager.addCurrentToCannonicalName​(String, String)
    org.robolectric.shadows.ShadowPackageManager.addPackage​(String)
    Use ShadowPackageManager.installPackage(PackageInfo) instead.
    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.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.setIsInteractive(boolean) instead.
    org.robolectric.shadows.ShadowScanResult.newInstance​(String, String, String, int, int)
    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.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.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() 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​(View)
    - 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).
    org.robolectric.util.Scheduler.idleConstantly​(boolean)
    This method is ambiguous in how it should behave when turning off constant idle. Use Scheduler.setIdleState(IdleState) instead to explicitly set the state.
  • Constructors 
    Constructor Description
    org.robolectric.android.XmlResourceParserImpl​(Document, String, String, String, ResourceTable)
    use XmlResourceParserImpl(Document, Path, String, String, ResourceTable) instead.
    org.robolectric.internal.ManifestIdentifier​(Path, Path, Path, String, List<Path>)
    Use ManifestIdentifier(String, Path, Path, Path, List) instead.
    org.robolectric.shadows.ShadowAlarmManager.ScheduledAlarm​(int, long, PendingIntent, PendingIntent)
  • Enum Constants 
    Enum Constant Description
    org.robolectric.annotation.LooperMode.Mode.LEGACY
    use LooperMode.PAUSED
    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
    REALTISTIC is the default mode and does not need to be stated explicity.
  • 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
Skip navigation links
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Index
  • Help
  • Robolectric 4.10 |