Get the AxeDevTools Library

Link to Get the AxeDevTools Library copied to clipboard

Add the library into your UI tests

Not for use with personal data

Setup

Requires:

Sample Application

You can download our sample application on GitHub to see a working example of the axe DevTools Mobile library implemented within a simple UI test. Add your Deque credentials and follow the README to begin scanning. This application is inaccessible to showcase axe DevTools Mobile's implementation steps and accessibility issue detection.

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

axe DevTools Mobile customers can utilize Deque's private Artifactory for library management. Use your Deque credentials to log in to agora.dequecloud.com and retrieve your artifactory API key. Add this API key, along with your Deque username to your project's build.gradle file. For complete details, please view the instructions for using Artifactory.

Implementation

In the application's build.gradle file, add:

androidTestImplementation 'com.deque.android:axe-devtools-android:6.2.0'
debugImplementation 'com.google.mlkit:text-recognition:16.0.1'

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'])

    androidTestImplementation 'com.deque.android:axe-devtools-android:6.2.0'
    debugImplementation 'com.google.mlkit:text-recognition:16.0.1'
    
    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'
}

Stay Up to Date

Doublecheck that your version of axe DevTools Mobile for Android is up to date, to ensure you have the latest rules and features. It does not automatically update, so you should check for a new version periodically. See How to Update axe DevTools Mobile for Android for details.

What's next? Automated Tests

Next, you'll set up your automated tests to scan for accessibility issues.