diff --git a/.gitignore b/.gitignore index fb24cf0..5bf1f3b 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,8 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +# Keystore files (sensitive - keep secure) +/android/app/*.jks +/android/app/*.keystore +/android/keystore.properties diff --git a/README.md b/README.md index 93f5d5c..f88065b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ # hadi_hoda_flutter A new Flutter project. + +## Building for Google Play Release + +This project includes a keystore for signing release builds for Google Play Store. + +### Security Setup +- **Keystore file**: `android/app/upload-keystore.jks` (excluded from git) +- **Properties file**: `android/keystore.properties` (excluded from git) +- **Key alias**: `upload` + +### Important Security Notes +- 🔐 Keystore files and passwords are excluded from version control +- 🔐 Keep `upload-keystore.jks` and `keystore.properties` files secure +- 🔐 Backup these files in a safe location separate from your code +- 🔐 Never share passwords or keystore files with unauthorized parties + +### Building Release APK + +To build a release APK for Google Play: + +```bash +flutter build apk --release +``` + +The APK will be generated in `build/app/outputs/flutter-apk/` with the name `Hadi & Hoda v{version}+{versionCode}.apk`. + +### Important Security Notes +- Keep the keystore file (`upload-keystore.jks`) secure and don't commit it to version control +- Backup the keystore file in a safe location +- Never share the passwords with unauthorized parties diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 7cc45f6..8e05a08 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -2,6 +2,8 @@ import kotlin.text.all import kotlin.text.find import kotlin.text.isNotEmpty import kotlin.text.replace +import java.io.FileInputStream +import java.util.Properties plugins { id("com.android.application") @@ -10,6 +12,12 @@ plugins { id("dev.flutter.flutter-gradle-plugin") } +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('keystore.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { namespace = "com.example.hadi_hoda_flutter" compileSdk = 36 @@ -35,11 +43,18 @@ android { versionName = flutter.versionName } + signingConfigs { + create("release") { + keyAlias = keystoreProperties['keyAlias'] + keyPassword = keystoreProperties['keyPassword'] + storeFile = file(keystoreProperties['storeFile']) + storePassword = keystoreProperties['storePassword'] + } + } + 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") } }