Every Android application update relies on cryptographic identity continuity: Android permits an incoming APK to upgrade an installed package only when both share the same package identifier, declare an equal or higher versionCode, and trace cleanly back to the original signing certificate.
1. Why Android Deprecated Legacy v1 (JAR) Signatures
Original APK v1 signatures operate at the individual ZIP entry level (META-INF/*.RSA and MANIFEST.MF). Because the ZIP central directory and unsigned metadata entries sit outside signature coverage, vulnerabilities such as Janus allowed attackers to prepend arbitrary bytes without invalidating v1 checks.
- APK Signature Scheme v2 (Android 7.0+): Inserts an explicit APK Signing Block directly before the ZIP Central Directory and hashes the entire binary byte range.
- APK Signature Scheme v3 (Android 9.0+): Adds Proof-of-Rotation lineage metadata so developers can safely rotate signing keys without breaking in-place upgrades.
- Android 11+ (API 30) Requirement: Apps targeting SDK 30 or newer must be signed with v2 (or higher); v1-only APKs fail installation immediately with
INSTALL_PARSE_FAILED_NO_CERTIFICATES.
2. Verifying Certificates Before Publishing Releases
Always run Android Build-Tools' apksigner on your final artifact—especially after zipalign! Note that running zipalign after apksigner corrupts v2/v3 block offsets; alignment must happen strictly before signing.
# Step 1: Align uncompressed native libraries & resources on 4-byte boundaries
zipalign -p -f -v 4 app-unsigned.apk app-aligned.apk
# Step 2: Sign with v2 and v3 enabled
apksigner sign --ks release-keystore.jks --v2-signing-enabled true --v3-signing-enabled true app-aligned.apk
# Step 3: Verify schemes and inspect certificate SHA-256 fingerprint
apksigner verify --verbose --print-certs app-aligned.apk
Self-Hosted Release Channels Never Have Play App Signing Rescue
Unlike Google Play's managed App Signing key escrow, self-hosted APKs rely 100% on your own keystore backups. Store release keystores encrypted offline in two redundant locations and assert the expected SHA-256 certificate digest in CI before uploading builds.
3. Comparing APK Signature Schemes v1, v2, v3, and v4
| Scheme | Android Minimum | Protected Scope | Key Rotation Support |
|---|---|---|---|
| v1 (JAR) | Android 1.0+ | Per-ZIP entry hashes only | No |
| v2 (APK Block) | Android 7.0 (API 24) | Whole APK byte range outside Signing Block | No |
| v3 (Rotation) | Android 9.0 (API 28) | Whole APK + Proof-of-Rotation lineage | Yes (via lineage file) |
| v4 (Incremental) | Android 11+ (API 30) | Detached .idsig Merkle tree for ADB streaming |
Follows v2/v3 cert |
4. Debugging Common Installation Rejections
INSTALL_FAILED_UPDATE_INCOMPATIBLE: The installed APK on the phone was signed with a debug key or older keystore whose SHA-256 differs from the incoming build. Check installed signature viaadb shell dumpsys package com.example.app | grep -A3 signatures.DOES NOT VERIFYafter post-processing: A compression, metadata stripping, orzipalignstep ran afterapksigner sign, shifting central directory offsets and invalidating v2/v3 hashes.- Play Protect or device architecture mismatch: Verify native
.soABIs (arm64-v8a,armeabi-v7a) insidelib/match the target hardware rather than shipping onlyx86_64emulator binaries.