Overview
Android requires all APKs and AABs to be digitally signed before installation. This ensures app authenticity and enables secure updates. TechSales uses different signing configurations for debug and release builds.Debug vs Release Signing
Debug Signing
Debug builds are automatically signed with a debug keystore:- Location:
~/.android/debug.keystore - Password:
android - Alias:
androiddebugkey - Valid for: Development only
Release Signing
Release builds require a production keystore that you create and manage securely.Generating a Release Keystore
Generate Keystore
Use You’ll be prompted to enter:
keytool to generate a new keystore:- Keystore password (choose a strong password)
- Key password (can be same as keystore password)
- Your name and organization details
Configuring Signing in Gradle
Updateapp/build.gradle.kts to include signing configuration:
Storing Credentials Securely
Using Environment Variables
Set environment variables before building:Using gradle.properties
Creategradle.properties in your project root (add to .gitignore):
build.gradle.kts:
Using Android Studio
Android Studio provides a UI for signing:- Build > Generate Signed Bundle / APK
- Select AAB or APK
- Choose existing keystore or create new
- Enter passwords
- Select build variant (release)
Google Play App Signing
Google Play App Signing is recommended for managing your app signing key securely.
- Google manages your app signing key
- You upload an AAB signed with an upload key
- Google re-signs with the app signing key
- You can reset lost upload keys
Enrollment
- Upload your first release AAB to Google Play Console
- Opt in to Google Play App Signing
- Google generates or imports your app signing key
- Download the upload key certificate for future updates
Verifying Signed APKs
Check the signature of your signed APK:Key Management Best Practices
Backup Keystores
Store keystore files in multiple secure locations:
- Encrypted cloud storage
- Secure password manager
- Offline encrypted USB drive
Document Credentials
Record in a secure location:
- Keystore location
- Keystore password
- Key alias
- Key password
- Validity dates
Restrict Access
- Limit keystore access to authorized team members
- Use role-based access in CI/CD systems
- Audit keystore usage regularly
CI/CD Signing
For automated builds, store credentials securely: GitHub Actions:For complete build instructions, see Building Release APKs/AABs.