Key Takeaways
- OWASP Mobile Top 10 remains the definitive reference for mobile security threats. In 2026, insecure data storage and inadequate API security are still the two most common vulnerabilities in Android applications.
- The Android Keystore system, combined with EncryptedSharedPreferences and biometric authentication, provides a hardware-backed security foundation that every production app should use. Storing sensitive data in plain SharedPreferences is a critical vulnerability.
- Network security configuration, certificate pinning, and API authentication tokens must be implemented together. Securing one without the others leaves exploitable gaps.
- Google’s Play Integrity API has replaced SafetyNet as the standard for device and app attestation. Apps that have not migrated remain vulnerable to tampered environments.
- Privacy regulations are now enforced globally. India’s Digital Personal Data Protection Act (DPDP), GDPR in Europe, and state-level privacy laws in the US all require explicit consent management, data minimisation, and the right to erasure in your Android application.
Security is the part of Android development that most teams acknowledge is important and then consistently underinvest in. I have seen it across hundreds of projects over 17 years: the security review gets pushed to “after launch,” the penetration test gets descoped from the budget, and the encryption implementation gets marked as a “nice to have” in the sprint backlog.
Then something goes wrong. A data breach. A credential leak. A Play Store rejection because of a policy violation. And suddenly, security becomes everyone’s top priority at exactly the point where fixing it is most expensive. This is the guide I wish every Android developer on our team would read before writing their first production line of code. These are the practical steps that actually matter, based on real vulnerabilities I have encountered in production applications, not theoretical exercises from a textbook. For a broader context on where Android development stands today, my modern Android development guide covers the full technology landscape.
The Threat Landscape for Android in 2026
The OWASP Mobile Top 10 is the standard reference for mobile security threats. In 2026, the most common vulnerabilities in Android apps remain remarkably consistent:
| # | Vulnerability | What Goes Wrong | How Common |
| 1 | Insecure Data Storage | Sensitive data stored in plain text, unencrypted databases, or accessible file paths | Very Common |
| 2 | Inadequate API Security | Missing authentication, exposed endpoints, and insufficient rate limiting | Very Common |
| 3 | Insecure Communication | HTTP instead of HTTPS, missing certificate pinning, weak TLS configuration | Common |
| 4 | Insufficient Authentication | Weak password policies, missing multi-factor authentication, improper session management | Common |
| 5 | Code Tampering / Reverse Engineering | Unobfuscated code, missing integrity checks, exposed API keys in source | Moderate |
The good news: all of these are preventable with the right implementation. The bad news: most teams still ship production apps without addressing at least two of these properly.
Secure Data Storage: The Foundation
1. Use EncryptedSharedPreferences for All Sensitive Key-Value Data
The Android Jetpack Security library provides EncryptedSharedPreferences as a drop-in replacement for standard SharedPreferences. It uses AES-256 encryption with keys stored in the Android Keystore, which means the encryption keys are hardware-backed and cannot be extracted, even on a rooted device.
If your app stores authentication tokens, user preferences with PII, or any sensitive configuration in plain SharedPreferences, you have a critical vulnerability. This is the single most common security issue I encounter in Android code reviews.
2. Use Room with SQLCipher for Database Encryption
Room is the standard database layer for modern Android development. But Room databases are stored as plain SQLite files that can be read with any SQLite browser on a rooted device. For any application storing sensitive user data locally, encrypting the database with SQLCipher adds a layer of protection that prevents data extraction even if the device is compromised.
3. Never Hardcode API Keys, Secrets, or Credentials
This sounds obvious. It still happens constantly. API keys embedded in strings.xml, BuildConfig fields, or Kotlin companion objects are trivially extractable through decompilation. Use server-side key management. If client-side keys are unavoidable, use the Android Keystore to encrypt them at rest and retrieve them at runtime.
Network Security: Protecting Data in Transit
1. Enforce HTTPS with Network Security Configuration
Android’s network security configuration allows you to define your app’s HTTPS requirements declaratively in an XML file. At a minimum, configure cleartext traffic blocking for all domains and define trusted certificate authorities.
2. Implement Certificate Pinning
Certificate pinning ensures your app only trusts specific certificates for your backend servers, preventing man-in-the-middle attacks even if a device’s certificate store is compromised. OkHttp’s CertificatePinner makes this straightforward to implement. Pin against your certificate’s public key hash, not the certificate itself, so you do not need an app update when the certificate rotates.
3. Secure Your API Layer
Server-side security is not the Android developer’s job alone, but understanding the mobile side of API security is essential. Use short-lived access tokens with refresh token rotation. Send tokens in the Authorization header, never in URL query parameters. Implement request signing for sensitive operations. Validate all server responses and handle error states gracefully without leaking internal server information to the client.
Authentication and Authorisation
1. Implement Biometric Authentication Properly
The BiometricPrompt API is the standard for biometric authentication on Android. Use it with a CryptoObject bound to the Android Keystore for genuine cryptographic authentication, not just a biometric gate that unlocks a stored password. The difference matters: a properly implemented CryptoObject ensures that the biometric verification is cryptographically tied to the key material, making it resistant to bypass attacks.
2. Migrate to Play Integrity API
Google’s Play Integrity API replaced the deprecated SafetyNet Attestation API. It verifies three things: the app is genuine (not tampered with), the device is genuine (not an emulator or rooted), and the user is genuine (has a valid Google Play account). If your app still uses SafetyNet, migration is overdue.
Code Protection and Build Security
1. Enable R8/ProGuard for Code Obfuscation
Every production Android release should use R8 with obfuscation enabled. This does not make your code impossible to reverse-engineer, but it significantly raises the effort required. Without obfuscation, your entire application logic, class names, and method signatures are trivially readable through decompilation.
2. Audit Dependencies Regularly
Your app’s security is only as strong as its weakest dependency. Use tools like Dependabot (GitHub), Snyk, or OWASP Dependency-Check to scan your Gradle dependencies for known vulnerabilities. Set up automated scanning in your CI/CD pipeline so that vulnerable dependencies are flagged before they reach production.
3. Scan for Secrets in Your Repository
Use tools like GitLeaks or TruffleHog to scan your repository history for accidentally committed API keys, credentials, or tokens. This should be part of your CI/CD pipeline. A single committed secret in your Git history is a vulnerability, even if you deleted it in a later commit, because Git preserves history.
Privacy Compliance: DPDP, GDPR, and Beyond
Privacy regulation enforcement accelerated significantly in 2025–2026. India’s Digital Personal Data Protection Act (DPDP), GDPR in Europe, and state-level privacy laws in the US all impose requirements on how Android apps collect, store, and process personal data.
For Android developers, the practical requirements are:
- Explicit consent: Collect consent before processing personal data. Implement a consent management flow that records when and what the user consented to.
- Data minimisation: Only collect data your app genuinely needs. Request only the permissions that are essential for your core functionality.
- Right to erasure: Implement a mechanism for users to request deletion of their data. This includes local data on the device and server-side data.
- Data export: Under GDPR, users have the right to export their data in a portable format. Build this capability into your user settings.
For teams building apps in regulated industries, understanding how AI-assisted development tools handle code generation for sensitive data flows is particularly important. AI-generated code often defaults to the simplest implementation, which may not meet compliance requirements.
The Security Checklist That Actually Matters
Here is the condensed checklist I use for every Android project before it goes to production. It is not exhaustive, but it covers the vulnerabilities that account for over 90% of real-world security incidents in Android applications:
| Security Check | Priority |
| All sensitive data is encrypted at rest (EncryptedSharedPreferences / SQLCipher) | Critical |
| No hardcoded API keys, secrets, or credentials in source code | Critical |
| HTTPS enforced, cleartext traffic blocked via network security config | Critical |
| Certificate pinning implemented for all backend communication | High |
| BiometricPrompt with CryptoObject for authentication flows | High |
| Play Integrity API integrated (SafetyNet deprecated) | High |
| R8/ProGuard obfuscation enabled for release builds | High |
| Dependency vulnerability scanning in CI/CD pipeline | High |
| Git secret scanning (GitLeaks / TruffleHog) | Medium |
| Privacy consent management flow implemented | Medium (Critical for regulated industries) |
| User data export and deletion capabilities | Medium (Required for GDPR/DPDP compliance) |
Security is not a feature you add at the end. It is a quality standard you maintain from the first commit. The cost of retrofitting security into an existing codebase is 5–10 times higher than building it in from the start.



