Repository navigation
Build Guide
English · 한국어
This page takes you from a fresh clone to an installable APK. The FOSS build needs nothing but Android Studio. The Google (GMS) build comes in two forms that differ in how much artwork you have to supply: gmsDev needs only the ten weather icons and is the light way to work on the Google code, while gmsProd, the build published on Google Play, also needs the symbol pictures that are not in the repository.
| Android Studio | Current stable, with the Android SDK for API 37 |
| JDK |
18 (sourceCompatibility/targetCompatibility and jvmTarget are 18) |
| Gradle | The wrapper in the repository (Gradle 9.6) |
| Android Gradle Plugin | 9.4.1 (declared in gradle/libs.versions.toml) |
| Kotlin / KSP / Hilt | Kotlin 2.4.21, KSP 2.3.6, Hilt 2.60.1 |
minSdk / targetSdk
|
26 (Android 8.0) / 37 |
Open the project root (aaf-easydiary/) in Android Studio and let it sync. compileSdk and targetSdk both come from appCompileSdk = 37 in app/build.gradle.kts.
Four product flavors are defined in app/build.gradle.kts; the flavor dimension is mode:
| Flavor | Google libraries | Purpose |
|---|---|---|
gmsProd |
Yes | What is published to Google Play and GitHub Releases; all nine symbol categories |
gmsDev |
Yes | For developing and checking the Google features; weather and tasks symbols only |
foss |
No | What F-Droid builds; no Google Drive, no calendar sync, fewer symbols |
lab |
Yes | A scratch flavor that reuses gmsProd's code and resources; not published |
Each flavor has debug and release build types, so the variants are gmsProdRelease, fossRelease, and so on. Release builds enable R8 (isMinifyEnabled) and resource shrinking, and are named app-<variant>-<versionName>.apk. The version lives in appVersionCode and appVersionName at the top of app/build.gradle.kts.
The symbol artwork differs by flavor, because the two files involved live in each flavor's source set: FlavorUtils.sequenceToSymbolResourceId(), which turns a symbol number into a drawable, and res/values/arrays_symbol.xml, which builds the categories of the symbol picker.
gmsProd, lab
|
gmsDev |
foss |
|
|---|---|---|---|
| Symbol categories | All nine | Weather and tasks | Weather and tasks |
| Symbol pictures | 297 | 14 | 9 |
| Pictures in the repository | 5 (the four task icons, logo_google_calendar) |
4 (the task icons) | 9 |
| Pictures you must supply | 292 | 10 | None |
The 297 pictures of gmsProd break down as weather 15 (including three temperature and two dust icons), emotion 53, daily 43, food 32, leisure 37, landscape 15, symbol 24, flag 74 and tasks 4. 292 of them have to sit in app/src/gmsProd/res/drawable/, a folder that the app/src/gmsProd/res/drawable/ic_* line of .gitignore excludes, so a fresh clone cannot compile gmsProd or lab.
gmsDev needs only the ten Flaticon weather icons, in app/src/gmsDev/res/drawable/ (excluded the same way). Its symbol picker shows the weather and tasks categories only; the Google code behind it is the same as gmsProd's.
foss uses five weather and four task symbols, and its weather PNGs are committed under app/src/foss/res/drawable-*dpi, so there is nothing to supply.
Both build types use one signing config that reads two properties from local.properties in the project root (the file is git-ignored, so create it):
storeFile=/absolute/path/to/your-signing-key.jks
storePassword=your-keystore-passwordThe key alias is fixed to android and the key password is read from the same storePassword value, so a keystore made with the Android Studio wizard's defaults works as is. If you do not have a key, generate one per the Android documentation. Without local.properties the build still compiles but the release APK is signed with a placeholder named dummy.jks, which Android will not install as an update.
Nothing else is needed:
./gradlew assembleFossReleaseThe APK lands in app/build/outputs/apk/foss/release/. On Windows use gradlew.bat.
Things to expect in this flavor:
- Google Drive backup and the Google Calendar schedule are absent, and a schedule of either type arriving from a restored backup is switched off with a notification.
- The symbol picker has only the weather and tasks categories (five weather and four task symbols), because the emoji symbol arrays live in the
gmsProdresources. - The scheduled-work notification strings and screens that depend on Google libraries are the same; only the Google-backed paths are missing.
There are two GMS flavors, and they need different things. lab reuses gmsProd's code and resources, so it needs what gmsProd needs.
gmsProd needs app/src/gmsProd/res/values/keys.xml, which is git-ignored.
<!-- app/src/gmsProd/res/values/keys.xml -->
<resources>
<string name="oauth_request_id_token">YOUR_CLIENT_ID.apps.googleusercontent.com</string>
</resources>Create the OAuth 2.0 client in the Google Cloud console, enable the Google Drive API, and register the package name and your signing certificate's SHA-1 as an Android client.
gmsDev already has a file of that name in the repository (app/src/gmsDev/res/values/keys.xml, the developer's own client ID). To check sign-in with your own certificate, replace the value with your client ID and leave the changed file out of your commits.
The GMS build draws weather from ten vector icons that come from the Flaticon pack "weather-set-2". These are all gmsDev needs, and gmsProd starts with the same ten. Download the pack, then in Android Studio choose File → New → Vector Asset for each SVG, set the resource directory to gmsDev or gmsProd, and name them as follows:
| SVG | Resource |
|---|---|
clouds-and-sun.svg |
ic_clouds_and_sun.xml |
umbrella-1.svg |
ic_umbrella_1.xml |
sunny.svg |
ic_sunny.xml |
stars-2.svg |
ic_stars_2.xml |
snowing.svg |
ic_snowing.xml |
raindrops.svg |
ic_raindrops.xml |
rainbow.svg |
ic_rainbow.xml |
night-rain.svg |
ic_night_rain.xml |
moon-9.svg |
ic_moon_9.xml |
bolt.svg |
ic_bolt.xml |
These drawables are git-ignored too (app/src/gmsDev/res/drawable/ic_* and app/src/gmsProd/res/drawable/ic_*). To build both flavors, put the same ten files in both folders.
gmsProd and lab need more than the ten above, all in app/src/gmsProd/res/drawable/:
- Three temperature icons (
ic_temperature,ic_temperature_1,ic_temperature_2) and two dust icons (ic_dust,ic_dust_storm) — the five entries that onlygmsProd's weather array has. - 277 emoji, symbol and flag files such as
ic_001_happyandic_245_canada, named after the array number and the symbol. Their artwork comes from the Flaticon packs credited inTHIRDPARTY.md(emoji-17, linear-color-emoticons, food-and-drink-9, landscapes-collection, daily-routine-objects-actions-3, international-flags). -
ic_driveandic_server, which the dashboard layout uses.
Every file name is listed in sequenceToSymbolResourceId() of app/src/gmsProd/java/me/blog/korn123/commons/utils/FlavorUtils.kt, and the array names and order in app/src/gmsProd/res/values/arrays_symbol.xml say which symbol each file belongs to.
Unless you need a build identical to the published app, you can develop against gmsDev without filling these in; the Google code is the same in both flavors.
./gradlew assembleGmsDevDebugThe gmsProd release is built with:
./gradlew assembleGmsProdReleaseThe APKs land in app/build/outputs/apk/gmsDev/debug/ and app/build/outputs/apk/gmsProd/release/. In Android Studio, pick the variant in Build → Select Build Variant and run.
Unit tests live in app/src/test:
./gradlew testThey cover the logic that is worth pinning down without a device: tag name rules and tag share arithmetic, streak calculation, the time-zone handling of all-day entries, clickable links, the draft auto-save, the Jasypt encryption helpers, the ZIP helpers (archive classification and the Keystore envelope for scheduled backup passwords), and a check that no string is missing from any locale. Instrumented tests in app/src/androidTest need a device or emulator.
Room exports its schema to app/schemas/me.blog.korn123.easydiary.data.local.AppDatabase/ (ksp { arg("room.schemaLocation", …) }). 1.json … 9.json are committed; the database is at version 9.
When you change an entity:
- edit the entity,
- build, so KSP writes the new
N.json, - write the migration in
data/local/Migrations.kt, - register it with
addMigrations(...)inDatabaseModule, - commit the entity, the new schema JSON and the migration together.
The committed schema files are what a reviewer compares between versions, so a missing JSON is a missing record of the change.
| Symptom | Cause |
|---|---|
keys.xml unresolved in a GMS build |
The git-ignored app/src/gmsProd/res/values/keys.xml is missing — see above |
ic_sunny.xml unresolved in a GMS build |
The ten weather icons are missing from that flavor's res/drawable
|
Symbol pictures such as ic_001_happy unresolved in a gmsProd build |
The emoji, flag and temperature pictures are missing; gmsProd needs 292 — see above |
ic_drive / ic_server unresolved in a gmsProd build |
The two icons that the dashboard layout uses are missing |
| Release APK will not install over the published app | Different signing key (yours), or a FOSS build over a Play build |
Unsupported class file major version |
Wrong JDK; the project needs 18 |
| Google sign-in fails at runtime | The OAuth client's package name or SHA-1 does not match the certificate you built with |
| Room schema error after an entity change | The migration or the exported schema is missing for the new version |
English
Developer
한국어
개발자