chore: upgrade toolchain to AGP 9.2.1 / Gradle 9 / nixpkgs 26.05
build / build (push) Has been cancelled

- nixpkgs 25.11 → 26.05; gradle_9 + jdk21; build-tools 35 → 36
- Drop custom gradle wrapper — GRADLE_OPTS works post-nixpkgs PR #449037
- AGP 8.7.3 → 9.2.1; Kotlin plugin removed (built-in since AGP 9)
- compileSdk/targetSdk 34 → 35; buildToolsVersion pinned to 36.0.0
- Java/Kotlin target 17 → 21; resValues feature flag required by AGP 9
- applicationVariants (removed in AGP 9) → androidComponents.onVariants
- Test task: testWeatherReleaseUnitTest → :app:test (all flavors, debug)
- CI artifact path fixed to cover all flavor APKs
- Docs: drop nix develop --command prefix (direnv activates shell)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 20:12:22 +02:00
parent 32e45c266d
commit b57e65f760
7 changed files with 44 additions and 60 deletions
+10 -12
View File
@@ -6,6 +6,7 @@ Runs on the living-room Sony Bravia KD-65XE9305 (Android 8.0, API 26;
Android System WebView updates independently via Play Store — currently v138).
Launched remotely through the Bravia REST IP-control API by Control4
(driver lives in a separate project). See README.md for the API sequence.
Build toolchain: AGP 9.2.1, Gradle 9 (nixpkgs 26.05), build-tools 36, compileSdk 35, JDK 21.
## Lab project — with deviations
@@ -20,21 +21,18 @@ This is a lab project (`lab` skill conventions apply) EXCEPT:
## NixOS aapt2 workaround
AGP cannot run the Maven-downloaded aapt2 on NixOS (dynamically linked
generic Linux binary). The flake's dev shell ships a wrapped `gradle` that
always passes `-Dorg.gradle.project.android.aapt2FromMavenOverride=<sdk
aapt2>` on the command line; Gradle turns `org.gradle.project.*` system
props into project properties, which is what AGP reads. It must be a CLI
arg: the nixpkgs-25.11 gradle wrapper ignores `GRADLE_OPTS` (fixed
post-25.11, nixpkgs PR #449037 — the flake wrapper can be dropped once
the pin moves past 25.11). No file rewriting; `gradle.properties` stays
untouched.
generic Linux binary). The dev shell sets `GRADLE_OPTS` to pass
`-Dorg.gradle.project.android.aapt2FromMavenOverride=<sdk aapt2>`;
Gradle turns `org.gradle.project.*` system props into project properties,
which is what AGP reads. Works since nixpkgs 26.05 (PR #449037 merged
post-25.11). No file rewriting; `gradle.properties` stays untouched.
## Commands (user-run, from repo root)
## Commands (user-run, from repo root, direnv activates devshell)
- Tests: `nix develop --command gradle --no-daemon :app:testWeatherReleaseUnitTest`
- All APKs: `nix develop --command gradle --no-daemon :app:assembleRelease`
- Tests: `gradle --no-daemon :app:test`
- All APKs: `gradle --no-daemon :app:assembleRelease`
`app/build/outputs/apk/<flavor>/release/<flavor>-release.apk`
- Single APK: `nix develop --command gradle --no-daemon :app:assembleWeatherRelease`
- Single APK: `gradle --no-daemon :app:assembleWeatherRelease`
- Sideload: `adb connect <tv-ip>:5555 && adb install -r <apk>`
(bump `versionCode` in app/build.gradle.kts first for upgrades)
- Fresh install: `adb uninstall cz.c3c.webviewkiosk && adb install <apk>`