Using the Android Integration
Use this integration to get Android accessibility results into the Stark dashboard
Quick-start with an AI prompt
Copy this into your AI coding agent of choice to get set up without having to work through the steps below by hand.
Set up Stark's Android accessibility integration in this project.
Facts to use as-is (don't search for alternatives or guess versions):
- Gradle plugin ID `co.getstark.accessibility`, version `1.0.1`, published on Maven Central.
- It bundles Stark's lint rules (70+ build-time checks on XML layouts) and an
instrumentation library that surfaces runtime issues from Google's Accessibility
Test Framework.
- Results upload to the Stark dashboard, categorized by WCAG success criteria.
- My Stark project token: PASTE_YOUR_TOKEN_HERE
(from app.getstark.co → Create a Project → Add Android app)
Steps:
1. Inspect the build setup and tell me whether this project uses Groovy
(`build.gradle`) or Kotlin DSL (`build.gradle.kts`) before editing anything.
2. Verify `mavenCentral()` is present in `pluginManagement.repositories` and
`dependencyResolutionManagement.repositories` in `settings.gradle[.kts]` — or in
`allprojects.repositories` in the root `build.gradle` if this project doesn't use
dependency resolution management. Add it if missing.
3. Apply the plugin in the app module's build file using the matching DSL syntax and
set the token in a `stark { }` block. Read the token from `gradle.properties` or an
environment variable instead of hardcoding it, and confirm that file is gitignored.
4. Show me the diff and stop there. Don't run anything yet.
Once I've approved the diff:
5. Run `./gradlew starkAccessibilityCheckDebug` and summarize what the lint results found.
6. Propose (don't write yet) an instrumentation test that uses `AccessibilityChecker`
with `runStandardChecks(rootView, "<screen name>")` against the launch activity, plus
a CI job that runs `./gradlew starkAccessibilityCheckRelease`.
Constraints: use exactly the plugin ID and version above, don't invent configuration
options, and if the build fails show me the real Gradle error before proposing a fix.With Stark's Android integration, you can unlock deeper accessibility scans and get your results to show up in the Stark dashboard alongside your other assets.
Using the Android Integration
Prerequisites
Ensure your project has Maven Central configured in both your settings.gradle (or settings.gradle.kts) and root build.gradle files:
In settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
}
dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
}
Or in your root build.gradle if not using dependency resolution management:
allprojects {
repositories {
mavenCentral()
google()
}
}
Apply the Stark Accessibility plugin to your app's build.gradle file:
plugins {
id 'co.getstark.accessibility' version '1.0.1'
}
stark {
starkToken = "your-stark-project-token"
}
Or if using Kotlin DSL (build.gradle.kts):
plugins {
id("co.getstark.accessibility") version "1.0.1"
}
stark {
starkToken.set("your-stark-project-token")
}
That's it! The plugin automatically adds the necessary dependencies:
- Lint rules for build-time accessibility checks - makes it so Stark can analyze your XML layouts and detect accessibility issues. The best way to check your code as it includes more than 70 built-in Stark checks.
- Instrumentation library for runtime accessibility testing - scans your actual running app during instrumentation tests and surfaces any accessibility issues from Google's Accessibility Test Framework.
Usage
Lint Checks
Once the plugin is applied, Stark's accessibility checks are automatically included in your project's lint process. The plugin also creates tasks for each build variant to upload lint results to Stark.
# Run lint checks (includes Stark's accessibility rules)
./gradlew lint
# Run lint and upload results to Stark
./gradlew starkAccessibilityCheckDebug
Instrumentation Testing
For runtime accessibility testing, use the AccessibilityChecker in your instrumentation tests:
@RunWith(AndroidJUnit4.class)
public class AccessibilityTest {
@Test
public void testMainActivityAccessibility() {
try (ActivityScenario scenario = ActivityScenario.launch(MainActivity.class)) {
scenario.onActivity(activity -> {
View rootView = activity.getWindow().getDecorView().getRootView();
AccessibilityChecker checker = new AccessibilityChecker("your-stark-project-token");
CompletableFuture> resultsFuture = checker.runStandardChecks(rootView, "MainActivity Scan");
try {
resultsFuture.get();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
}
}
Bringing scan results into Stark
- Log into your Stark account
- Click
Create a Project - Scroll to
Add Android app - Copy the Stark token shown into the
starkTokenfield mentioned above - Provide a
Namefor easy reference when viewing all of your assets - Run the integration tests or lint targets in Android Studio to see your results show up in Stark
Running checks in your CI/CD
You can run the Stark tasks in your CI/CD. An example using GitHub actions is shown below:
name: Stark Accessibility Scan
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
run-command:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Stark accessibility scan
run: |
echo "Running Stark accessibility scan..."
./gradlew starkAccessibilityCheckRelease
Have any questions about using Stark's developer tools? Don’t hesitate to reach out to us at support@getstark.co.