@Documented
@Inherited
@Retention(value=RUNTIME)
@Target(value={TYPE,METHOD})
public @interface Config
Configuration settings that can be used on a per-class or per-test basis.
Modifier and Type | Fields and Description |
---|---|
static int |
ALL_SDKS |
static java.lang.Class<? extends android.app.Application> |
DEFAULT_APPLICATION |
static java.lang.String |
DEFAULT_ASSET_FOLDER |
static java.lang.String |
DEFAULT_MANIFEST_NAME |
static java.lang.String |
DEFAULT_PACKAGE_NAME |
static java.lang.String |
DEFAULT_QUALIFIERS |
static java.lang.String |
DEFAULT_RES_FOLDER |
static int |
DEFAULT_VALUE_INT |
static java.lang.String |
DEFAULT_VALUE_STRING |
static int |
NEWEST_SDK |
static java.lang.String |
NONE
TODO(vnayar): Create named constants for default values instead of magic numbers.
|
static int |
OLDEST_SDK |
static int |
TARGET_SDK |
Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<? extends android.app.Application> |
application
The
Application class to use in the test, this takes precedence over any application specified in the AndroidManifest.xml. |
java.lang.String |
assetDir
Deprecated.
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
|
java.lang.String[] |
instrumentedPackages
A list of instrumented packages, in addition to those that are already instrumented.
|
java.lang.String[] |
libraries
Deprecated.
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
|
java.lang.String |
manifest
Deprecated.
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/
|
int |
maxSdk
The maximum Android SDK level to emulate when running tests on multiple API versions.
|
int |
minSdk
The minimum Android SDK level to emulate when running tests on multiple API versions.
|
java.lang.String |
packageName
Deprecated.
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(PackageInfo) first. |
java.lang.String |
qualifiers
Qualifiers specifying device configuration for this test, such as “fr-normal-port-hdpi”.
|
java.lang.String |
resourceDir
Deprecated.
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
|
int[] |
sdk
The Android SDK level to emulate.
|
java.lang.Class<?>[] |
shadows
A list of shadow classes to enable, in addition to those that are already present.
|
public static final java.lang.String NONE
TODO(vnayar): Create named constants for default values instead of magic numbers. Array named constants must be avoided in order to dodge a JDK 1.7 bug. error: annotation Config is missing value for the attribute <clinit> See JDK-8013485.
public static final java.lang.Class<? extends android.app.Application> DEFAULT_APPLICATION
public abstract int[] sdk
The Android SDK level to emulate. This value will also be set as Build.VERSION.SDK_INT.
public abstract int minSdk
The minimum Android SDK level to emulate when running tests on multiple API versions.
public abstract int maxSdk
The maximum Android SDK level to emulate when running tests on multiple API versions.
@Deprecated public abstract java.lang.String manifest
The Android manifest file to load; Robolectric will look relative to the current directory. Resources and assets will be loaded relative to the manifest.
If not specified, Robolectric defaults to AndroidManifest.xml
.
If your project has no manifest or resources, use NONE
.
public abstract java.lang.Class<? extends android.app.Application> application
The Application
class to use in the test, this takes precedence over any application specified in the AndroidManifest.xml.
Application
class to use in the test.@Deprecated public abstract java.lang.String packageName
Context.createPackageContext(String, int)
. Note that you must add this package to ShadowPackageManager.addPackage(PackageInfo)
first.Java package name where the “R.class” file is located. This only needs to be specified if you define an applicationId
associated with productFlavors
or specify applicationIdSuffix
in your build.gradle.
If not specified, Robolectric defaults to the applicationId
.
public abstract java.lang.String qualifiers
Qualifiers specifying device configuration for this test, such as “fr-normal-port-hdpi”.
If the string is prefixed with ‘+’, the qualifiers that follow are overlayed on any more broadly-scoped qualifiers.
See Device Configuration for details.
@Deprecated public abstract java.lang.String resourceDir
The directory from which to load resources. This should be relative to the directory containing AndroidManifest.xml.
If not specified, Robolectric defaults to res
.
@Deprecated public abstract java.lang.String assetDir
The directory from which to load assets. This should be relative to the directory containing AndroidManifest.xml.
If not specified, Robolectric defaults to assets
.
public abstract java.lang.Class<?>[] shadows
A list of shadow classes to enable, in addition to those that are already present.
public abstract java.lang.String[] instrumentedPackages
A list of instrumented packages, in addition to those that are already instrumented.
@Deprecated public abstract java.lang.String[] libraries
A list of folders containing Android Libraries on which this project depends.