Deprecated API
Contents
- Packages
- Interfaces
- Classes
- Enums
- Annotation Types
- Fields
- Methods
- Constructors
- Enum Constants
- Annotation Type Elements
-
Deprecated Packages
-
Deprecated InterfacesInterfaceDescriptionuse
Xml.asAttributeSet(XmlPullParser)
instead. Not supported inResourcesMode.Mode.NATIVE
UseXml.asAttributeSet(XmlPullParser)
instead.
-
Deprecated ClassesClassDescriptionNative Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.only works when used in conjunction with the deprecated
LooperMode.Mode.LEGACY
mode. Consider using guava'sMoreExecutors.directExecutor()
orPausedExecutorService
orInlineExecutorService
.UseMatrixCursor
instead.UseMatrixCursor
instead.use LooperMode.Mode.INSTRUMENTATION_TEST insteadDon't put more stuff here.This class will be deleted in a forthcoming Robolectric release.UseGnssStatus.Builder
instead where possible.AsyncTask
is deprecated in the Android SDK.AsyncTaskLoader
is deprecated in the Android SDK.useInputDeviceBuilder
.AsyncTask
is deprecated in the Android SDK.AsyncTaskLoader
is deprecated in the Android SDK.run on Android APIs >= S, which allows the real Android mime type data to be usedAsyncTask
is deprecated in the Android SDK.AsyncTaskLoader
is deprecated in the Android SDK.UseRangingResultBuilder
instead.UseRangingResultBuilder
instead.Scheduler APIs only function when using LooperMode.LEGACY. Switch to LooperMode.PAUSED and useinvalid reference
ShadowLooper
-
Deprecated EnumsEnumDescriptionThis enum is deprecated along with
TextLayoutMode
. The default behavior is now equivalent toTextLayoutMode.Mode.REALISTIC
mode, so this annotation is generally no longer needed.
-
Deprecated Annotation TypesAnnotation TypeDescriptionThis annotation will be deleted in a forthcoming Robolectric release.
-
Deprecated FieldsFieldDescriptionNot currently supported or used.Not currently supported or used.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.UseRuntimeEnvironment.getApplication()
instead. Note that unlike the alternative, this field is inherently incompatible withLazyApplication
. This field may be removed in a later releaseUseShadowTelecomManager.CallRecord.extras
instead.
-
Deprecated MethodsMethodDescriptionThe config change should be calculated internally by the activity controller based on the previous configuration, use
ActivityController.configurationChange(Configuration, DisplayMetrics)
instead.Use the appropriate builder inRobolectric
instead.This method will be removed in Robolectric 3.6.
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/Use theClassName
annotation or theImplementation.methodName()
annotation parameter instead.UseNativeObjRegistry.register(Object)
instead.UseNativeObjRegistry.unregister(long)
instead.useRobolectric.getAttributeSetFromXml(int)
insteadNative Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.Native Fragments have been deprecated in Android P. Android encourages developers to use androidx fragments, to test these use FragmentScenario.TheScheduler
APIs are designed for LEGACY Looper mode. UseShadowLooper.runToEndOfTasks()
instead.TheScheduler
APIs are designed for LEGACY Looper mode. UseShadowLooper.runToEndOfTasks()
instead.TheScheduler
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.TheScheduler
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.useinvalid reference
androidx.test.core.app.ActivityScenario
Provide a service implementation ofGlobalConfigProvider
instead. This method will be removed in Robolectric 4.3.Do not use.obsolete do not useTheScheduler
APIs are designed for LEGACY Looper mode. Prefer to migrate tests to PAUSED Looper mode to avoid the need for this API.TheScheduler
APIs are designed for LEGACY Looper mode. Prefer to migrate tests to PAUSED Looper mode to avoid the need for this API.UseActivityManager.getLockTaskModeState()
instead.Prefer using overload withShadowActivityManager.ApplicationExitInfoBuilder
do not usePrefer to useShadowAlarmManager.setAutoSchedule(boolean)
in combination with incrementing time to actually run alarms and test their side-effects.UseShadowAlertDialog.getLatestAlertDialog()
instead.UseShadowDialog.getLatestDialog()
instead.UseShadowPopupMenu.getLatestPopupMenu()
instead.use PackageManager.queryBroadcastReceivers insteaduse PackageManager.queryBroadcastReceivers insteadThis is only for LEGACY Looper mode. Use PAUSED Looper mode instead.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.Avoid use.use ShadowBitmap#getCreatedFromResId() instead.Use any of the BitmapFactory.decode methods with real image data.Use any of the BitmapFactory.decode methods with real image data.Use any of the BitmapFactory.decode methods with real image data.Use any of the BitmapFactory.decode methods with real image data.use real BluetoothLeAdvertiser insteadUse theLooperMode.Mode.PAUSED
looper andShadowChoreographer.getFrameDelay()
to configure the frame delay.useShadowChoreographer.getNextVsyncTimeNanos()
insteadUse theLooperMode.Mode.PAUSED
looper andShadowChoreographer.setFrameDelay(Duration)
to configure the frame delay.Use theLooperMode.Mode.PAUSED
looper instead.Use theLooperMode.Mode.PAUSED
looper andShadowChoreographer.setPaused(boolean)
andShadowChoreographer.setFrameDelay(Duration)
to configure the vsync event behavior.implementation detail - use public Android APIs insteadimplementation detail - use public Android APIs insteadimplementation detail - use public Android APIs insteadimplementation detail - use public Android APIs insteadimplementation detail - use public Android APIs insteadimplementation detail - use public Android APIs insteadimplementation detail - use public Android APIs insteadUseRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor instead.UseRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor instead.UseRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor instead.This method does not work withContentResolver.acquireContentProviderClient(android.net.Uri)
. Instead, useRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor.UseRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor instead.This method does not work withContentResolver.acquireContentProviderClient(android.net.Uri)
. Instead, useRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor.This method does not work withContentResolver.acquireContentProviderClient(android.net.Uri)
. Instead, useRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor.This method does not work withContentResolver.acquireContentProviderClient(android.net.Uri)
. Instead, useRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor.This method affects all calls, and does not work withContentResolver.acquireContentProviderClient(android.net.Uri)
. Instead, useRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor.This method affects all calls, and does not work withContentResolver.acquireContentProviderClient(android.net.Uri)
. Instead, useRobolectric.setupContentProvider(Class, String)
to install a test-specific ContentProvider that can return any Cursor.UseShadowCrossProfileApps.peekNextStartedActivity()
instead.This behavior is deprecated and will be removed in Robolectric 4.13.This behavior is deprecated and will be removed in Robolectric 4.13.This behavior is deprecated and will be removed in Robolectric 3.7.This method is deprecated and will be removed in Robolectric 4.13.useContextCompat.getDrawable(context, resourceId)
useShadowFingerprintManager.setDefaultFingerprints(int)
instead.Please add calls by adding a Call usingInCallService.InCallServiceBinder
.Please remove calls by invokingCall.disconnect()
.useInputDeviceBuilder
.useInputDeviceBuilder
.useInputDeviceBuilder
.useInputDeviceBuilder
.Use aHandler
instance to post to a looper.Use aHandler
instance to post to a looper.Do not test listeners, instead useShadowLocationManager.simulateLocation(Location)
and test the results of those listeners being invoked.Do not test listeners, instead useShadowLocationManager.simulateLocation(Location)
and test the results of those listeners being invoked.Do not test pending intents, instead useShadowLocationManager.simulateLocation(Location)
and test the results of those pending intent being invoked.Do not test pending intents, instead useShadowLocationManager.simulateLocation(Location)
and test the results of those pending intent being invoked.Do not test listeners, instead useShadowLocationManager.simulateLocation(Location)
and test the results of those listeners being invoked.UseShadowLocationManager.simulateGnssAntennaInfo(List)
instead.UseShadowLocationManager.simulateGnssStatus(GnssStatus)
instead.UseShadowLocationManager.simulateLocation(Location)
to update the last location for a provider.UseshadowOf({@link Looper#getMainLooper()})
instead.Use aHandler
instance to post to a looper.Use aHandler
instance to post to a looper.useMotionEvent.obtain()
orinvalid reference
androidx.test.core.view.MotionEventBuilder
useMotionEvent.obtain()
orinvalid reference
MotionEventBuilder
useMotionEvent.obtain()
orinvalid reference
androidx.test.core.view.MotionEventBuilder#setPointerAction(int, int)
UseShadowPackageManager.installPackage(PackageInfo)
instead.useShadowPackageManager.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 ofShadowPackageManager.installPackage(android.content.pm.PackageInfo)
,ShadowPackageManager.addOrUpdateActivity(android.content.pm.ActivityInfo)
,ShadowPackageManager.addActivityIfNotPresent(android.content.ComponentName)
or their counterparts for other types of components.see the note onShadowPackageManager.addResolveInfoForIntent(Intent, ResolveInfo)
.see the note onShadowPackageManager.addResolveInfoForIntent(Intent, ResolveInfo)
.It is recommended to switch to androidx's AsyncTaskLoader, which provides an overridable getExecutor method.this method only exists to accommodate legacy tests with preexisting issues. Silently discarding exceptions is not recommended, and can lead to deadlocks.preferShadowPendingIntent.isActivity()
which was added toPendingIntent
in API 31 (Android S).preferShadowPendingIntent.isBroadcast()
which was added toPendingIntent
in API 31 (Android S).preferShadowPendingIntent.isForegroundService()
which was added toPendingIntent
in API 31 (Android S).preferShadowPendingIntent.isService()
which was added toPendingIntent
in API 31 (Android S).PreferShadowPowerManager.turnScreenOn(boolean)
instead.UseShadowPowerManager.turnScreenOn(boolean)
instead.use ScanResult() insteaduse ScanResult() insteadUseShadowSensor.newInstance(int)
to construct yourSensor
and add to theSensorManager
usingShadowSensorManager.addSensor(Sensor)
instead. This method will be removed at some point allowing us to use more of the realSensorManager
code.Use{@link SensorEventBuilder#newBuilder()}
instead.Use{@link SensorEventBuilder#newBuilder()}
instead.Use{@link SensorEventBuilder#newBuilder()}
instead.Don't call this method directly; instead, useSystem.nanoTime()
.API deprecated since Q, for testing, use setDefaultDialerPackage insteadAvoid using.Avoid using.for resetAllSimCountryIsosuse resetAllSimStates()TelephonyManager.getNetworkType()
was replaced withTelephonyManager.getDataNetworkType()
in Android N, and has been deprecated in Android R. Useinstead
.preferShadowUsbDeviceConnection.getOutgoingDataStream()
, which allows callers to know how much data has been read and when theUsbDeviceConnection
closes.use either addUser() or addProfile()useShadowUserManager.setUserSwitchability(int)
insteadUseShadowUserManager.addUser(int, String, int)
to create a demo user instead of changing default user flags.UseShadowUserManager.addUser(int, String, int)
to create a guest user instead of changing default user flags.UseShadowUserManager.addUser(int, String, int)
to create a linked user instead of changing default user flags.UseShadowUserManager.addUser(int, String, int)
to create a primary user instead of changing default user flags.useShadowUserManager.addUser(int, String, int)
insteadUseShadowUserManager.addUser(int, String, int)
to create a system user instead of changing default user flags.When possible, please use the real Android framework APIinvalid reference
UserManager#setUserRestriction()
- Please use Espresso for View interactions.Please use Espresso for view interactions- Please useinvalid reference
androidx.test.espresso.util.HumanReadables#describe(View)
- Please useinvalid reference
androidx.test.espresso.util.HumanReadables#describe(View)
- Please useinvalid reference
androidx.test.espresso.util.HumanReadables#describe(View)
- Please useinvalid reference
androidx.test.espresso.util.HumanReadables#describe(View)
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.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 viaUiccPortInfo
.UseUiccCardInfoBuilder.setPhysicalSlotIndex(int)
for Android T+ instead.
-
Deprecated ConstructorsConstructorDescription
-
Deprecated Enum ConstantsEnum ConstantDescriptionuse LooperMode.PAUSED. LEGACY mode is not supported on Android SDKs > BaklavaThis mode is obsolete and will be removed soon.
LEGACY
mode is inaccurate, has known bugs and will be removed in a future release.REALISTIC
is the default mode and does not need to be stated explicitly.
-
Deprecated Annotation Type ElementsAnnotation Type ElementDescriptionIf 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/Use the
ClassName
annotation or theImplementation.methodName()
annotation parameter instead.