Getting Started
Quickly identify accessibility issues in your Android application.
The axe DevTools Android library lets your team find accessibility issues before they ship in production. Build the library into your application for manual testing or against your UI or unit tests. View the results from your scans in the axe DevTools Mobile dashboard.
axe DevTools supports XML layouts within manual and automated testing. Compose support is available only within Espresso UI tests.
Once you've imported the library laid out below, refer to the XML layout and Compose layout setup pages for implementation guidance.
Requires:
- Android API 22 or higher
- Username and Password for the axe DevTools Mobile Dashboard
Import The Library
Using Maven Central
Inside the project's build.gradle file add mavenCentral
to the repositories list. This may be within the buildscript
block, or the allprojects
block.
buildscript {
repositories {
mavenCentral()
}
}
or
allprojects {
repositories {
mavenCentral()
}
}
Using Artifactory
View the instructions for using artifactory.
Implementation
In the application build.gradle file, add:
implementation 'com.deque.android:axe-devtools-android:2.2.0'
and
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
//For Espresso Tests:
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
}
}
also, make sure there is Internet permission in the AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
Working Example
Below is a complete sample application build.gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
dataBinding {
enabled = true
}
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 22
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
//For Espresso Tests:
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.deque.android:axe-devtools-android:2.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Sample Application
Download our sample application on GitHub. Add your Deque credentials and follow the README to get started running scans right away. This application is inaccessible to showcase the axe DevTools Mobile implementation steps and its issue detection.