# SMART CART Android release checklist

## Current status

This repository now contains an Android Studio WebView-shell source project in `android\`, alongside the existing standalone HTML storefront. The source configures application ID `in.smartcart.app`, API 26 minimum (Android 8.0), API 36 compile/target SDK, and source version `0.1.0` / version code 1. These are configuration values only—not a release or compatibility claim.

This environment has no Java/JDK, Gradle, Android SDK, `adb`, or `bundletool`, and network access to the Gradle distribution and wrapper bootstrap timed out. The source export therefore omits the Gradle wrapper launcher rather than shipping a broken one. No APK, AAB, universal APK, or signed release has been built; no device install/startup test was possible. Do not distribute a file described as a SMART CART Android release until it has passed the checks below.

## Before building the Android project

1. The current source project packages the existing website in a native Android WebView shell using AndroidX `WebViewAssetLoader`. This preserves the website rather than duplicating its preview logic. It does not add native OTP, camera, push, order, stock, delivery, or payment services.
2. Connect and test the production backend before claiming customer/shopkeeper login, OTP, orders, stock, delivery, or payments work in the app. The current storefront explicitly uses preview data.
3. Install Android Studio Stable with its bundled JDK 17+, a local Gradle 8.13 distribution, Android SDK Platform 36 and Build Tools. In Android Studio Gradle settings, select the local Gradle distribution. Confirm that target SDK 36 still meets Google Play policy at submission time.
4. The project configures `minSdk = 26` (Android 8.0). Test Android 8, a current API, at least one low-memory device profile, and different screen densities before claiming support.
5. The configured ID is `in.smartcart.app` (confirm Play Console availability before publishing), visible name `SMART CART`, source version `0.1.0` / code `1`, and a vector adaptive launcher icon/splash. Update version values for every release.

## Build a signed APK and AAB in Android Studio

1. Open the completed Android project in Android Studio and wait for Gradle sync to finish without errors.
2. Select **Build → Generate Signed Bundle / APK…**.
3. Select **APK** and then **Android App Bundle** in separate runs. Use the same application ID and release-signing identity for the APK update channel and Play upload.
4. If no release keystore exists, create one in the wizard. Store the keystore and recovery backup outside the repository in a controlled owner-managed location. Do not commit the keystore, passwords, signing files, or credentials. Losing the signing key can prevent updates to a sideloaded app.
5. Select the release build variant, finish the wizard, and note the generated output paths. Android Studio's standard Gradle output locations are:
   - `app\build\outputs\apk\release\app-release.apk`
   - `app\build\outputs\bundle\release\app-release.aab`
6. To reproduce a release build from PowerShell after local Gradle is installed:

   ```powershell
   Set-Location C:\path\to\smart-cart\android
   gradle clean :app:assembleRelease :app:bundleRelease
   ```

   Expected output paths are above only when the project uses the standard `app` module and task configuration.
7. Optionally generate the standard Gradle wrapper locally with `gradle wrapper --gradle-version 8.13`, then commit the generated scripts/JAR only if the owner wants a wrapper in the source.

## Verify before distribution

1. Verify the APK signature using the `apksigner.bat` shipped with the installed Android SDK Build Tools:

   ```powershell
   & "$env:LOCALAPPDATA\Android\Sdk\build-tools\<installed-version>\apksigner.bat" verify --verbose --print-certs "app\build\outputs\apk\release\app-release.apk"
   ```

2. Validate the AAB with the official `bundletool`:

   ```powershell
   java -jar C:\path\to\bundletool.jar validate --bundle="app\build\outputs\bundle\release\app-release.aab"
   ```

3. Record a checksum for each release file:

   ```powershell
   Get-FileHash "app\build\outputs\apk\release\app-release.apk" -Algorithm SHA256
   Get-FileHash "app\build\outputs\bundle\release\app-release.aab" -Algorithm SHA256
   ```

4. Install on a connected test device with Android's normal installer flow:

   ```powershell
   adb devices
   adb install -r "app\build\outputs\apk\release\app-release.apk"
   ```

5. Test clean install and update install, app startup, navigation, permissions, offline/poor-network errors, image loading, and the configured authentication and backend flows. Verify an update preserves user data and is signed by the same app identity. Do not claim compatibility beyond the tested SDK/device matrix.
6. Before publishing, complete the Play listing, icon/screenshots, privacy policy, Data Safety disclosures, content rating, support details and review. An AAB build alone does not mean the app is published.

## Universal APK and source backup

Google Play AAB files are not ordinary tap-to-install APKs. If a universal APK is needed, generate it from the signed AAB with the official `bundletool` after the project and signing setup are complete, then verify its signature and install it on test devices. A universal APK can be larger than device-specific Play downloads.

Create a source ZIP only from the completed Android source project. Exclude `.jks`/`.keystore` files, passwords, local signing properties, credentials, generated secrets, and unnecessary build output. A ZIP of this HTML website is not an Android source project.

## Release page policy

The official download page must show an APK button only when it links to the actual signed APK that passed these checks. Show the real version, file size, release date, supported Android range, SHA-256 checksum, and signing identity for that build. Keep Play Store status separate, and never describe a browser/PWA install as a native APK.
