This skill should be used when the user asks about "Android permissions", "runtime permissions", "camera permission", "storage permission", "notifications", "Photo Picker", "Credential Manager", "Predictive Back", "per-app language", "Baseline Profiles", "Android 16", "adaptive layouts", "Android crash", "Gradle sync fails", "build error", "ANR", "ProGuard", "R8", "Android emulator", or mentions requesting permissions, using platform APIs, troubleshooting Android errors, or dealing with crashes and build failures. Provides permissions guidance, modern platform features, and troubleshooting for Android development.
Guide users through Android platform features, runtime permissions, and troubleshooting. Cover modern APIs that replace older approaches, permission best practices, and common error resolution. Emphasis on current best practices — many online tutorials teach deprecated patterns.
Disclaimer: This skill provides educational guidance for learning Android development. For production apps handling sensitive user data, payment processing, authentication, or security-critical features, consult a professional Android developer or security auditor.
Before requesting a permission, check if you actually need it:
Do I need this capability?
├── Camera → REQUEST_PERMISSION (CAMERA)
├── Location → REQUEST_PERMISSION (ACCESS_FINE_LOCATION or COARSE)
├── Pick a photo/video → USE Photo Picker (no permission needed!)
├── Read/write media → USE MediaStore API (scoped storage, no permission needed for own files)
├── Read all files → AVOID if possible; REQUEST_PERMISSION (READ_MEDIA_IMAGES etc.) if needed
├── Notifications (API 33+) → REQUEST_PERMISSION (POST_NOTIFICATIONS)
├── Bluetooth (API 31+) → REQUEST_PERMISSION (BLUETOOTH_CONNECT)
└── Contacts, Calendar, etc. → REQUEST_PERMISSION (specific permission)
ActivityResultContracts.RequestPermission() (not the deprecated onRequestPermissionsResult)Features that replace older approaches — present with rolling API requirements:
| Feature | Min API | What It Replaces | Why It Matters |
|---|---|---|---|
| Photo Picker | 19 (backported) | READ_EXTERNAL_STORAGE for media selection | No permission needed; scoped, privacy-preserving |
| Credential Manager | 23 (backported) | SmartLock, legacy login flows | Passkeys, passwords, federated sign-in in one API |
| Predictive Back | 34+ (opt-in, default on API 35+) | onBackPressed() override | System back gesture shows preview; breaks apps that don't handle it |
| Per-app Language | 33+ | Manual locale switching | System-managed language per app |
| Baseline Profiles | 24+ | No equivalent | 15-50% cold start improvement; profiles compiled AOT |
| Scoped Storage | 29+ (enforced 30+) | WRITE_EXTERNAL_STORAGE | App-specific dirs without permission; MediaStore for shared media |
| Foreground Service Types | 34+ | Untyped foreground services | Must declare type (camera, location, etc.) in manifest |
| Adaptive Layouts | Recommended for all | Fixed orientation lock | Can't restrict orientation on large screens (Android 16+) |
Predictive Back is on by default starting API 35. Apps that override onBackPressed() or use FLAG_ACTIVITY_CLEAR_TOP carelessly will break. To prepare:
OnBackPressedCallback instead of overriding onBackPressed()android:enableOnBackInvokedCallback="true" in the manifest to test| Error / Symptom | Likely Cause | Fix |
|---|---|---|
Gradle sync failed | Version mismatch, missing SDK | Check references/troubleshooting.md |
Unresolved reference after adding dependency | Missing Gradle sync | Sync Gradle files |
| App crashes on rotation | State not in ViewModel | Move state to ViewModel + StateFlow |
NetworkOnMainThreadException | Network call on Main thread | Use Dispatchers.IO in repository |
| Compose preview blank | Missing @Preview parameter defaults | Add default parameter values |
INSTALL_FAILED_OLDER_SDK | Device API < minSdk | Lower minSdk or use newer device |
| Emulator won't start | Hardware acceleration disabled | Enable VT-x/AMD-V in BIOS |
Could not find :compose-bom | Missing Google Maven repository | Add google() to repositories block |
| R8/ProGuard strips needed class | Missing keep rule | Add -keep rule for the class |
java.lang.OutOfMemoryError during build | Insufficient Gradle heap | Increase org.gradle.jvmargs in gradle.properties |
Flag these areas for professional review — they're beyond educational scope:
local.properties or BuildConfig injectionreferences/permissions-guide.md — Runtime permissions patterns with complete code examplesreferences/platform-features.md — Credential Manager, Predictive Back, Photo Picker, Baseline Profiles deep divesreferences/troubleshooting.md — Common errors, Gradle failures, crash debugging, emulator fixes