Security for Android Developers
Android security protects user data and the app itself. It includes storing secrets with Keystore-backed encryption, verifying that requests come from a genuine app with the Play Integrity API, and shrinking and obfuscating code with R8 to make reverse engineering harder. None of these is a substitute for server-side checks.
Stage: Quality and Performance · Part of the Android Developer roadmap · Last reviewed 19 November 2026
What to learn in Security
- Keep tokens in encrypted storage backed by the Android Keystore
- Explain why API keys inside an APK should be treated as public
- Enable R8 shrinking and obfuscation in a release build
- Request a Play Integrity verdict and verify it on your server
- Enforce HTTPS and avoid cleartext traffic in the network config
Security interview questions
Is it safe to store an API key in your Android app?
No. Anything packaged in an APK can be extracted, so a key there should be considered public. Keep real secrets on your server and have the app call your backend, which holds the key. Restrict any client-side keys by package name and signing certificate where the provider allows.
What does R8 do in a release build?
R8 shrinks the app by removing unused code and resources, optimises bytecode, and obfuscates class and method names. This reduces size and makes reverse engineering harder. You may need keep rules for code reached through reflection, or the release build can crash.
Where Security fits in the Android Developer roadmap
Security belongs to the Quality and Performance stage (beginner level), which takes about 5 hours. Reliable and fast.
Other units in this stage
Back to the full Android Developer roadmap