Android R Compatibility Test Suite (CTS) is a free, official tool from Google that checks whether a device (phone, tablet, TV, etc.) correctly implements the Android R (Android 11) APIs and behaviors. It runs a set of automated tests against the device and reports failures, helping manufacturers, carriers, and developers ensure apps run consistently across devices.
What Is the Compatibility Test Suite?
The Compatibility Test Suite is part of the Android Compatibility Program, which defines what it means to be “Android-compatible.” Google provides the CTS (and its companion, CTS Verifier) so that device manufacturers can validate their builds against the Android Compatibility Definition Document (CDD). Passing CTS is a prerequisite for a device to use the Google Mobile Services (GMS) suite, including the Play Store, Google Play Services, and other Google apps.
For Android R (API level 30, released in 2020), CTS includes thousands of tests covering areas like telephony, Wi-Fi, Bluetooth, camera, sensors, graphics, storage, security, and app compatibility. The tests are written in Java and run on the device via the Android Test Framework (often using JUnit). A device that passes all required CTS tests is considered “CTS-compliant” for that Android version.
How Does CTS Work?
CTS is a client-server system. The host machine (a computer with the Android SDK) runs the CTS test runner, which communicates with the device over USB or network. The runner pushes test APKs to the device, executes them, and collects results. The tests are grouped into modules (e.g., android.telephony, android.hardware.camera2) and plans (e.g., CTS, CTS-GSI, CTS-on-GSI).
To run CTS, you need:
- A device with a userdebug or eng build (or a build that has the necessary test hooks).
- Android SDK Platform Tools (adb and fastboot).
- The CTS package (downloaded from the Android Compatibility downloads page).
- A host machine with Java and a supported OS (Linux recommended).
Typical steps:
- Unlock the device bootloader and flash a compatible build.
- Enable developer options and USB debugging.
- Run
cts-tf(the CTS test harness) with a plan, e.g.,./cts-tradefed run cts. - Wait for the tests to finish (can take several hours).
- Review the results in the generated XML/HTML reports.
Why Is CTS Important?
CTS ensures that apps written for Android run correctly on any compliant device. Without CTS, manufacturers could alter the platform in ways that break app compatibility—for example, changing camera behavior or failing to implement required APIs. CTS also helps developers by providing a consistent target: if your app works on one CTS-compliant device, it likely works on others.
For manufacturers, passing CTS is mandatory to license GMS. For developers, CTS is useful for testing their apps against a broad set of device behaviors, though they usually rely on the Android Emulator or physical devices instead of running the full suite.
Common Problems and Misconceptions
One common misconception is that CTS is only for manufacturers. While it’s true that manufacturers run it, developers and advanced users can also run it to verify custom ROMs or to test app compatibility. Another misconception is that CTS is a single test—it’s actually a suite of thousands of tests.
Common issues when running CTS:
- Test failures due to missing hardware: Some tests require specific sensors or features; if a device lacks them, the test may fail (though the CDD may allow exemptions).
- Build type issues: CTS requires a userdebug build; a standard user build may not expose required test hooks.
- Environment problems: USB connection drops, insufficient storage, or incorrect Java version can cause failures.
- Network-dependent tests: Some tests need internet access; ensure the device has a stable connection.
If a test fails, the report shows the specific test case and a log. Often, the issue is a device-specific bug that the manufacturer must fix—not a problem with CTS itself.
How to Choose the Right CTS Version
CTS versions are tied to Android versions. For Android R, you need the CTS package labeled “Android 11” (or “R”). Google releases updated CTS packages periodically (e.g., CTS 11 R1, R2, etc.) to fix test bugs or add new tests. Always use the latest stable CTS release for the Android version you’re testing, as it reflects the current CDD requirements.
You can download CTS from the Android Compatibility downloads page. The package includes a README with instructions and a changelog. For custom ROM developers, it’s common to use the same CTS version that the device’s stock firmware uses to compare results.
Note: CTS is not the same as the Vendor Test Suite (VTS), which tests the vendor implementation of the HALs and kernel. For Android R, VTS is also required for full compliance.
CTS vs. Other Test Suites
Besides CTS, there are several related test suites:
- CTS Verifier: A manual test suite that requires human interaction for things like camera quality, sensors, and audio. It complements CTS by testing features that can’t be fully automated.
- Vendor Test Suite (VTS): Tests the vendor-specific components (e.g., HALs, kernel) to ensure they work with the Android framework.
- Google Test Suite (GTS): Tests the GMS components themselves (e.g., Google Play Services).
- Android Test Suite (ATS): A newer umbrella term for all these suites, often used in the context of Android 10+.
For a device to be fully certified, it must pass CTS, CTS Verifier, VTS, and GTS (if GMS is included).
Cost and Accessibility
CTS itself is free to download and use. The main costs are time and hardware—you need a device and a host machine. Running CTS can take several hours, and you may need to repeat tests after fixing issues. There’s no licensing fee from Google for using CTS; the cost comes from the engineering effort to fix failures.
For small developers or hobbyists, running a full CTS run on a custom ROM is feasible but time-consuming. Many choose to run only a subset of tests (e.g., run cts --module android.media) to check specific areas.
Safety and Precautions
Running CTS involves flashing a test build, which can void warranties and potentially brick a device if done incorrectly. Always back up your data and ensure you have the correct factory images. Use a device that you’re willing to lose. Also, CTS tests can stress hardware (e.g., camera, GPS) for extended periods, so monitor temperatures.
If you’re a developer, you don’t need to run CTS to develop apps—use the emulator or a physical device for normal testing. CTS is mainly for those building or modifying the Android OS.
Frequently Asked Questions
Can I run CTS on a regular retail phone? No, you need a userdebug or eng build, which is typically only available on developer devices (e.g., Pixel) or custom ROMs. Retail builds are user builds and don’t expose the necessary test hooks.
How long does a full CTS run take? It varies by device and test plan, but a full run can take anywhere from 4 to 12+ hours. You can run a subset to save time.
What does a CTS failure mean? It means the device doesn’t meet a specific compatibility requirement. The failure report includes the test name and logs. Manufacturers must fix the underlying issue to pass certification.
Is CTS the same as the Android Compatibility Definition Document (CDD)? No, the CDD is a document that describes the requirements; CTS is the tool that tests those requirements. They work together.
Do I need to run CTS for my custom ROM? If you want your ROM to be considered “Android-compatible” and to support GMS, yes. Otherwise, you can skip it, but your ROM may have compatibility issues.
Can I use CTS to test my app? CTS is not designed for app testing; it tests the platform. For app testing, use the Android Testing Support Library and tools like Espresso.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Soil Box Resistivity Test: How It Works
- Soil Box RS3: How to Use It & Get Soil
- Soil Box Testing: What It Is & How to Use
- Soil Sample Box: Types, Uses & How to Choose
- Soil Sifting Box: Types, Uses & Buying Guide
- Can You Use a Box Blade to Till Soil? A Complete Guide