From 8a798fec6bb3566745b01ef55a4a0cf03f147335 Mon Sep 17 00:00:00 2001 From: Tero Date: Mon, 9 Nov 2026 22:17:55 +0200 Subject: [PATCH] Upgrade Android build tooling for 0.5.20 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- README.md | 2 ++ android/app/build.gradle | 2 +- android/build.gradle | 8 +++++++- android/gradle.properties | 3 +++ android/gradle/wrapper/gradle-wrapper.properties | 3 ++- package-lock.json | 4 ++-- package.json | 2 +- tests/build-version.test.cjs | 15 +++++++++++++++ 8 files changed, 33 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c42af6f..b2d8f32 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ npm run android:apk The debug APK is written to `android/app/build/outputs/apk/debug/app-debug.apk` and copied to `release/ep-mail -debug.apk`; install it on a connected test device with `adb install -r android/app/build/outputs/apk/debug/app-debug.apk`. For a signed release, configure `EP_MAIL_ANDROID_STORE_FILE` (an absolute path), `EP_MAIL_ANDROID_STORE_PASSWORD`, `EP_MAIL_ANDROID_KEY_ALIAS`, and `EP_MAIL_ANDROID_KEY_PASSWORD` in the build environment, then run `npm run android:release-apk`. The signed artifact is copied to `release/ep-mail .apk`; keep keystores and passwords out of the repository and logs. The first account enables a visible, ongoing foreground-service notification while IMAP IDLE checks for new mail; Android also runs a network-constrained periodic reconciliation. Notification sender/subject details are hidden by default; enabling them in Settings still keeps lock-screen previews redacted. Android may delay or stop background activity after force-stop, prolonged device restrictions, or vendor battery management. +Android builds use the Gradle wrapper and Android Gradle Plugin 9.4.0. Capacitor's generated modules are aligned to that plugin version during the build; the legacy Android DSL and external Kotlin plugin remain enabled for compatibility and must be migrated before upgrading to AGP 10. + On Android, previously cached folder messages appear while the mailbox refreshes; a folder without cached messages still needs to load from the server. Folder discovery and message actions run separately from cached-folder loading. The app stays in the message list until you select a message; returning to the list does not automatically reopen the newest message. While reading a message on Android, swipe in from the screen edge using the system Back gesture, or use the Back button in the reader, to return to the same position in the message list. diff --git a/android/app/build.gradle b/android/app/build.gradle index b45a9a9..8c1307c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -56,7 +56,7 @@ android { buildTypes { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' if (hasCompleteReleaseSigning) signingConfig signingConfigs.release } } diff --git a/android/build.gradle b/android/build.gradle index d301c06..c537348 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,7 +7,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.13.0' + classpath 'com.android.tools.build:gradle:9.4.0' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21' classpath 'com.google.gms:google-services:4.4.4' @@ -19,6 +19,12 @@ buildscript { apply from: "variables.gradle" allprojects { + // Capacitor-generated modules declare their own AGP version. + buildscript { + configurations.classpath { + resolutionStrategy.force 'com.android.tools.build:gradle:9.4.0' + } + } repositories { google() mavenCentral() diff --git a/android/gradle.properties b/android/gradle.properties index ac73da1..efa9b47 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -20,3 +20,6 @@ org.gradle.jvmargs=-Xmx1536m # Android operating system, and which are packaged with your app's APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true +# Capacitor's generated modules and the current Kotlin plugin still use the legacy AGP APIs. +android.builtInKotlin=false +android.newDsl=false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 7912cdb..0a637bf 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ +#Mon Nov 09 22:05:03 EET 2026 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/package-lock.json b/package-lock.json index 669d6ef..6aaf88f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ep-mail", - "version": "0.5.19", + "version": "0.5.20", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ep-mail", - "version": "0.5.19", + "version": "0.5.20", "dependencies": { "@capacitor/android": "^8.5.2", "@capacitor/core": "^8.5.2", diff --git a/package.json b/package.json index 890bd41..8db3e95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ep-mail", - "version": "0.5.19", + "version": "0.5.20", "private": true, "description": "Eternity Project mail client", "homepage": "https://git.eternityproject.fi/thuttu/ep-mail-client", diff --git a/tests/build-version.test.cjs b/tests/build-version.test.cjs index 3d5c082..5032fe3 100644 --- a/tests/build-version.test.cjs +++ b/tests/build-version.test.cjs @@ -11,6 +11,9 @@ const buildAll = fs.readFileSync(path.join(root, 'scripts', 'build-all.ps1'), 'u const androidDebugScript = fs.readFileSync(path.join(root, 'scripts', 'build-android-apk.cjs'), 'utf8'); const androidReleaseScript = fs.readFileSync(path.join(root, 'scripts', 'build-android-release-apk.cjs'), 'utf8'); const desktopWorkflow = fs.readFileSync(path.join(root, '.github', 'workflows', 'desktop-build.yml'), 'utf8'); +const androidRootBuild = fs.readFileSync(path.join(root, 'android', 'build.gradle'), 'utf8'); +const androidProperties = fs.readFileSync(path.join(root, 'android', 'gradle.properties'), 'utf8'); +const androidWrapper = fs.readFileSync(path.join(root, 'android', 'gradle', 'wrapper', 'gradle-wrapper.properties'), 'utf8'); test('package metadata and lockfile share one release version', () => { assert.equal(packageLock.version, packageJson.version); @@ -45,3 +48,15 @@ test('Android debug APK is labeled as debug and release APK requires signing cre assert.match(androidReleaseScript, /EP_MAIL_ANDROID_KEY_PASSWORD/); assert.match(androidReleaseScript, /ep-mail \$\{version\}\.apk/); }); + +test('Android Gradle and generated Capacitor modules use a compatible plugin version', () => { + const plugin = androidRootBuild.match(/classpath 'com\.android\.tools\.build:gradle:([^']+)'/); + const forced = androidRootBuild.match(/resolutionStrategy\.force 'com\.android\.tools\.build:gradle:([^']+)'/); + assert.ok(plugin && forced); + assert.equal(plugin[1], forced[1]); + assert.equal(plugin[1], '9.4.0'); + assert.match(androidWrapper, /gradle-9\.7\.1-bin\.zip/); + assert.match(androidProperties, /^android\.builtInKotlin=false$/m); + assert.match(androidProperties, /^android\.newDsl=false$/m); + assert.match(androidBuild, /getDefaultProguardFile\('proguard-android-optimize\.txt'\)/); +});