From fb0d820b4e304f0e40e3185e999ab0287b9cb675 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 2 Oct 2025 22:26:41 -0500 Subject: [PATCH] Get Android builds in a good place --- .gitignore | 1 + android/app/build.gradle | 26 ++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 086cb28e..55785d81 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ dist-ssr .env.* !.env.example .ai/ +*.keystore diff --git a/android/app/build.gradle b/android/app/build.gradle index 93205c94..f43e710d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -16,10 +16,36 @@ android { ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' } } + + signingConfigs { + release { + def keystorePath = rootProject.file("../shakespeare.keystore") + + // Only require keystore for release builds + def taskNames = gradle.startParameter.taskNames.toString() + def isReleaseBuild = taskNames.contains("Release") || taskNames.contains("release") || taskNames.contains("bundle") + + if (!isReleaseBuild) { + // Skip signing config for debug builds + return + } + + if (!keystorePath.exists()) { + throw new GradleException("shakespeare.keystore not found! Expected at: " + keystorePath.absolutePath) + } + + storeFile keystorePath + keyAlias "mykey" + storePassword "shakespeare" + keyPassword "shakespeare" + } + } + buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.release } } } diff --git a/package.json b/package.json index 688c6bc1..90e92f90 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "typecheck": "npm i --silent && tsc --noEmit", "test": "npm i --silent && eslint && vitest run --reporter=dot --silent && echo 'All tests passed!'", "deploy": "npm run build && npx -y nostr-deploy-cli deploy --skip-setup", - "android:build": "npm run build && npx cap sync android && npx cap build android", + "android:build": "npm run build && npx cap sync android && cd android && ./gradlew bundleRelease", "android:apk": "npm run android:sync && cd android && ./gradlew assembleDebug", "android:open": "npx cap open android", "android:sync": "npm run build && npx cap sync android",