Testing Android Apps Across OS Versions: Complete Guide
Android OS versions aren't backward-compatible—not entirely. Code that works on Android 16 might fail on Android 17. A feature that passes on Android 16 might fail on Android 17.
Each Android version introduces breaking changes: new permission models, deprecated APIs, changed behaviors, new features. Testing across OS versions is how you ensure your app works for all users, regardless of which version they're running.
The challenge: if you support Android 16-17, test both versions. Multiply that by device variations, and testing scope explodes. This guide explains how to test across OS versions strategically—catching compatibility issues without testing exhaustively.
Understanding Android OS Version Changes
Major Breaking Changes by Version:
Android 16:
- Edge-to-edge is mandatory for apps targeting API 36
- Large screens can ignore orientation and aspect-ratio locks
- Window insets have to be handled or the layout clips
Android 17:
- Stricter memory limits, including MemoryLimiter exits
- Background audio and layout rules from Android 16 become requirements
- A pass on Android 16 does not prove the same build on Android 17
Key Areas to Test Across OS Versions
API Level Compatibility:
- APIs available at each Android version
- APIs marked deprecated (work but will be removed)
- APIs removed in new versions
Test across your minimum supported API level and target API level.
Permissions Model:
- Runtime permissions on Android 16-17
- Scoped storage
- Bluetooth runtime permission
- Per-app language
Permissions handling varies significantly. Test every permission request on supported Android versions.
UI & Navigation:
- Gesture navigation on Android 16-17
- Large-screen and foldable layouts on Android 16
- Stricter layout rules on Android 17
Test UI across Android versions to catch layout/navigation issues.
Background Execution:
- Background execution on Android 16-17
- Location access
- Foreground service restrictions
If your app uses background services, test extensively across versions.
Storage Access:
- Scoped storage on Android 16-17
- App-specific directories
- No broad external-storage access
File access code works very differently across versions. Test thoroughly.
Network & Connectivity:
- HTTPS on Android 16-17
- DNS over HTTPS
- Network security policy
Test network calls across versions.
Setting Up OS Version Testing
Android Emulator – Multiple OS Versions:
Create separate emulator instances for each Android version:
1. Open Android Studio
2. Tools → Device Manager
3. Create a Pixel for Android 16 and a Pixel for Android 17
4. Launch each separately as needed
Each emulator is isolated, letting you test version-specific behavior.
Physical Devices with Different OS Versions:
If using real devices, maintain devices with different OS versions:
- One Pixel on Android 16
- One Pixel on Android 17
Firebase Test Lab – Multi-Version Testing:
Run automated tests across multiple OS versions in Firebase Test Lab:
1. Configure test matrix with OS versions
2. Run test suite
3. Tests execute on all OS versions automatically
4. Reports show failures by OS version
Cloud Device Labs:
Services like BrowserStack provide real devices across OS versions. Useful for manual testing.
Common OS Version Compatibility Issues
API Level Mismatches:
// WRONG: API 30+ only, fails outside Android 16-17
val response = MediaStore.getDocumentUri(...)
// CORRECT: Check API level first
val response = if (Build.VERSION.SDK_INT >= 30) {
MediaStore.getDocumentUri(...)
} else {
oldMethod()
}
Fix: Check API level before using new APIs. Use AndroidX compatibility libraries.
Permission Denials:
// WRONG: Assumes permission is granted
val location = LocationManager.requestLocationUpdates(...)
// CORRECT: Check permission first (Android 16-17)
if (ContextCompat.checkSelfPermission(
this, Manifest.permission.ACCESS_FINE_LOCATION
) == PackageManager.PERMISSION_GRANTED) {
LocationManager.requestLocationUpdates(...)
} else {
ActivityCompat.requestPermissions(...)
}
Fix: Always check permissions at runtime. Handle denials gracefully.
Scoped Storage Issues (Android 16-17):
// WRONG: Direct file path access (won't work on Android 16-17)
val file = File("/storage/emulated/0/DCIM/photo.jpg")
// CORRECT: Use MediaStore or app-specific directory
val collection = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL)
val cursor = contentResolver.query(collection, ...)
Fix: Use MediaStore for shared files. Use app-specific directories for app data.
Deprecated Warnings:
When targeting new Android versions, you'll see deprecation warnings in Android Studio. Fix them before the deprecated API is removed.
Background Execution Failures (Android 16-17):
// WRONG: Long-running background thread
thread {
// This might be killed by Android
while (true) {
doWork()
}
}
// CORRECT: Use foreground service or WorkManager
startForegroundService(Intent(this, MyService::class.java))
// OR
WorkManager.getInstance().enqueueUniquePeriodicWork(...)
Fix: Use appropriate background APIs for your use case (foreground services, WorkManager, etc.).
Testing Workflow for OS Versions
Step 1: Identify Supported OS Range
- Minimum supported: Android 16-17
- Target: Latest Android version
- Document this clearly
Step 2: Build Test Matrix
Android 16
Android 17
Test at least 3 versions (min, mid, target). If supporting 6+ versions, test more versions.
Step 3: Set Up Testing Environment
Create emulators (or get devices) for each version. Keep list of devices.
Step 4: Automated Testing Across Versions
- Write tests covering critical features
- Run tests on all OS versions
- Capture results by version
Step 5: Manual QA Testing
QA team tests critical features on real devices (especially minimum and target versions).
Step 6: Target Latest Android Version
Always target the latest Android version in your build.gradle:
android {
compileSdk = 36 // Android 16-17
targetSdkVersion = 36
minSdkVersion = 36 // Android 16-17
}
Step 7: Monitor Post-Release
After release, use Play Console to monitor crashes by Android version. This reveals version-specific issues.
Handling Version-Specific Code
When OS versions have different behavior, use version checks:
Version Check Pattern:
when {
Build.VERSION.SDK_INT >= 36 -> {
// Android 16-17
useNewApi()
}
else -> {
useLegacyApi()
}
}
Using AndroidX Compatibility Libraries:
AndroidX provides compatibility wrappers for APIs across versions:
// Works across Android versions
ContextCompat.checkSelfPermission(context, permission)
ContextCompat.startActivity(context, intent, options)
NotificationCompat.Builder(context).setContentTitle("...").build()
Prefer AndroidX libraries over version checking when possible (cleaner code).
Testing Strategy by Feature Type
Files & Storage:
- Test file write/read on Android 16-17 (scoped storage changes)
- Test directory access across versions
- Test permission flows on Android 16-17
Permissions:
- Test runtime permission requests on Android 16-17
- Test permission denials
- Test permission changes between OS versions
Background Tasks:
- Test on Android 16-17 (background restrictions)
- Test foreground services
- Test WorkManager
Notifications:
- Test notification channels (Android 16-17)
- Test notification permissions (Android 16-17)
- Test notification appearance across versions
Location:
- Test location permission (varies by version)
- Test location access in background
- Test approximate location (Android 16-17)
Connectivity:
- Test HTTPS enforcement (Android 16-17)
- Test network security policies
- Test WiFi/cellular switching
Using Build Variants for Version-Specific Features
If your app needs drastically different implementations for different OS versions, use build variants:
flavorDimensions = ["osVersion"]
productFlavors {
minSupported {
targetSdk 34
}
latest {
targetSdk 35
}
}
This lets you build separate APKs optimized for different OS versions (advanced technique).
Testing Tools That Support Multiple Versions
Android Studio Emulator: Create multiple emulator instances for different OS versions.
Firebase Test Lab: Specify OS versions in test matrix, run tests automatically.
Espresso with Parameterized Tests: Run same tests across multiple OS versions.
@RunWith(Parameterized::class)
class OsVersionTests(private val osVersion: Int) {
// Tests run on multiple OS versions
}
Device Simulation Platforms: Like DevicesChanger, let you define testing scenarios targeting specific OS versions, simplifying multi-version testing.
Conclusion
Testing across OS versions ensures your app works for all users, regardless of which Android version they're running. The key is smart sampling: test your minimum supported version (catch legacy issues), target version (leverage new features), and 1–2 middle versions.
Use emulators for rapid testing, cloud device labs for broader coverage, and real devices for high-impact features. Monitor crash data post-release to continuously improve version compatibility.
Teams that master OS version testing reduce version-specific bugs, support legacy Android versions confidently, and adopt new features quickly.
Related pages
How Device Changer fits
Structured device simulation and device profiles help teams run the workflows above with reproducible Android contexts—aligned with QA testing and mobile testing practice.
Interface screenshots
FAQ
How does this relate to physical device labs?
Use simulation and profiles to scale coverage; validate critical builds on real hardware before release.
Where should automation sit in the pipeline?
Automate stable checks early (CI); keep exploratory and edge scenarios in dedicated QA passes.