Browse Source

feat: Add production release build configuration

- Configure keystore signing for release builds
- Add ProGuard rules for code obfuscation and optimization
- Update build.gradle.kts with release signing configuration
- Add Google Play Core dependency for compatibility
- Generate production-ready Android App Bundle (AAB)
- Document release build process and configuration
Fszontagh 5 months ago
parent
commit
e8500e98f9
3 changed files with 152 additions and 3 deletions
  1. 88 0
      RELEASE_BUILD_SUMMARY.md
  2. 27 3
      android/app/build.gradle.kts
  3. 37 0
      android/app/proguard-rules.pro

+ 88 - 0
RELEASE_BUILD_SUMMARY.md

@@ -0,0 +1,88 @@
+# ZenTap Release Build Summary
+
+## ✅ Successfully Completed
+
+### 1. Keystore Creation
+- **File**: [`android/app/zentap-release-key.jks`](android/app/zentap-release-key.jks) (2.7KB)
+- **Alias**: `zentap`
+- **Validity**: 10,000 days (27+ years)
+- **Algorithm**: RSA 2048-bit
+
+### 2. Signing Configuration
+- **Key Properties**: [`android/key.properties`](android/key.properties)
+- **Build Configuration**: Updated [`android/app/build.gradle.kts`](android/app/build.gradle.kts)
+- **ProGuard Rules**: Created [`android/app/proguard-rules.pro`](android/app/proguard-rules.pro)
+
+### 3. Release Bundle Generation
+- **File**: [`build/app/outputs/bundle/release/app-release.aab`](build/app/outputs/bundle/release/app-release.aab)
+- **Size**: 51MB
+- **Status**: ✅ Successfully built and signed
+- **Minification**: Enabled with ProGuard/R8
+- **Shrinking**: Resource shrinking enabled
+
+## 📁 Generated Files
+
+```
+android/
+├── key.properties               # Keystore configuration
+└── app/
+    ├── zentap-release-key.jks  # Release signing keystore
+    ├── proguard-rules.pro      # ProGuard obfuscation rules
+    └── build.gradle.kts        # Updated with signing config
+
+build/app/outputs/bundle/release/
+└── app-release.aab             # Ready for Google Play Store
+```
+
+## 🚀 Next Steps
+
+1. **Upload to Google Play Console**:
+   - Go to [Google Play Console](https://play.google.com/console)
+   - Upload `app-release.aab` file
+   - Complete store listing information
+
+2. **Backup Important Files**:
+   - Store `zentap-release-key.jks` securely
+   - Keep `key.properties` safe (contains passwords)
+   - Note: These files are required for future app updates
+
+3. **Security Recommendations**:
+   - Change keystore passwords from defaults
+   - Store keystore in secure location
+   - Consider using Google Play App Signing
+
+## ⚙️ Build Configuration Details
+
+### Dependencies Added
+- `com.google.android.play:core:1.10.3` - For Play Store compatibility
+
+### ProGuard Rules
+- Google Play Games services preservation
+- Google Play Core library preservation
+- Flutter framework preservation
+
+### Build Features
+- **Minification**: Enabled (reduces app size)
+- **Resource Shrinking**: Enabled (removes unused resources)
+- **Code Obfuscation**: Enabled (protects source code)
+
+## 📊 Build Optimizations
+
+- **Font Assets**: Tree-shaken (99.6% reduction)
+  - CupertinoIcons: 257KB → 1KB
+  - MaterialIcons: 1.6MB → 6KB
+- **Bundle Format**: AAB (Android App Bundle) for optimal delivery
+- **Target SDK**: Latest Android version support
+
+## 🔐 Security Features
+
+- **App Signing**: Production-ready keystore
+- **Code Protection**: ProGuard obfuscation enabled
+- **Asset Optimization**: Unnecessary debug symbols removed
+
+---
+
+**Build Date**: 2025-05-30  
+**Flutter Version**: Latest stable  
+**Target Platform**: Android (Google Play Store)  
+**Bundle Size**: 51MB (optimized)

+ 27 - 3
android/app/build.gradle.kts

@@ -1,3 +1,6 @@
+import java.util.Properties
+import java.io.FileInputStream
+
 plugins {
     id("com.android.application")
     id("kotlin-android")
@@ -5,6 +8,12 @@ plugins {
     id("dev.flutter.flutter-gradle-plugin")
 }
 
+val keystoreProperties = Properties()
+val keystorePropertiesFile = rootProject.file("key.properties")
+if (keystorePropertiesFile.exists()) {
+    keystoreProperties.load(FileInputStream(keystorePropertiesFile))
+}
+
 android {
     namespace = "hu.fsociety.zentap"
     compileSdk = flutter.compileSdkVersion
@@ -30,11 +39,24 @@ android {
         versionName = flutter.versionName
     }
 
+    signingConfigs {
+        create("release") {
+            keyAlias = keystoreProperties["keyAlias"] as String?
+            keyPassword = keystoreProperties["keyPassword"] as String?
+            storeFile = keystoreProperties["storeFile"]?.let { file(it) }
+            storePassword = keystoreProperties["storePassword"] as String?
+        }
+    }
+
     buildTypes {
         release {
-            // TODO: Add your own signing config for the release build.
-            // Signing with the debug keys for now, so `flutter run --release` works.
-            signingConfig = signingConfigs.getByName("debug")
+            signingConfig = signingConfigs.getByName("release")
+            isMinifyEnabled = true
+            isShrinkResources = true
+            proguardFiles(
+                getDefaultProguardFile("proguard-android-optimize.txt"),
+                "proguard-rules.pro"
+            )
         }
     }
 }
@@ -47,4 +69,6 @@ dependencies {
     // Google Play Services for Games
     implementation("com.google.android.gms:play-services-games-v2:17.0.0")
     implementation("com.google.android.gms:play-services-auth:20.7.0")
+    // Google Play Core for split installs
+    implementation("com.google.android.play:core:1.10.3")
 }

+ 37 - 0
android/app/proguard-rules.pro

@@ -0,0 +1,37 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
+
+# Flutter specific rules
+-keep class io.flutter.app.** { *; }
+-keep class io.flutter.plugin.**  { *; }
+-keep class io.flutter.util.**  { *; }
+-keep class io.flutter.view.**  { *; }
+-keep class io.flutter.**  { *; }
+-keep class io.flutter.plugins.**  { *; }
+
+# Google Play Games
+-keep class com.google.android.gms.games.** { *; }
+-keep class com.google.android.gms.auth.** { *; }
+
+# Google Play Core
+-keep class com.google.android.play.core.** { *; }
+-dontwarn com.google.android.play.core.**