Files
foto-duplicate-finder-free/app/build.gradle.kts
T
SoftwareApp 3afa7d777d fix: cut 1.0.2 with versionCode 3, because Play has already used 2
Play Console rejected the 1.0.1 bundle with "Version code 2 has already been used. Try another
version code." - the upload consumed code 2, so re-uploading that artifact can never succeed. The
next release therefore takes versionCode 3 and versionName 1.0.2, which also gives the pending
edge-to-edge fix a version of its own instead of leaving it unreleased.

Rebuilt both artefacts from the new configuration and checked them rather than assuming the bump
propagated: aapt2 dump badging on the release APK reports versionCode='3' versionName='1.0.2'
targetSdk=36, apksigner confirms the upload certificate (AA:8C:3D:6C:...:4C:7A), and the permission
set is unchanged - still no INTERNET. The AAB is 2,940,935 bytes (sha256 534e5ae9...), and the
unit suite is green: 80 tests, 0 failures, 0 errors.

The documents that carried versionCode 2 as the next upload are corrected: the checklist's
versioning step now quotes the rejection, its artifact row carries the new size and hash, ROADMAP
points at versionCode 3, and the 1.0.1 figures stay as history rather than being overwritten.

The first-upload language around pricing is no longer true either, so it is rewritten: code 2 has
already been uploaded, which means the Console pricing state has to be checked before this rollout
instead of set from scratch. If Products > App pricing still offers "Make your app paid", it has to
be done before the app is offered for free, because that switch is one-way.

CHANGELOG records the new 1.0.2 section with both the versionCode explanation and the edge-to-edge
fix, and the checklist gains a ready-to-paste 1.0.2 "What's new" block.
2026-10-18 16:59:50 +02:00

195 lines
7.4 KiB
Kotlin

import java.util.Properties
import org.gradle.api.tasks.testing.Test
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
}
// Optional release signing.
//
// Create a `keystore.properties` file in the project ROOT (it is git-ignored; see
// keystore.properties.example) with:
//
// storeFile=/absolute/path/to/upload-keystore.jks
// storePassword=********
// keyAlias=upload
// keyPassword=********
//
// Without that file the release build still runs R8/minification but produces an
// unsigned APK, which is fine for local checks but cannot be uploaded to Play.
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties().apply {
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.inputStream().use { load(it) }
}
}
val hasReleaseSigning = keystoreProperties.getProperty("storeFile") != null
if (hasReleaseSigning) {
// Fail early and readably instead of letting signReleaseBundle blow up later
// with an opaque NullPointerException.
val missing = listOf("storePassword", "keyAlias")
.filter { keystoreProperties.getProperty(it).isNullOrBlank() }
check(missing.isEmpty()) {
"keystore.properties is incomplete — missing: ${missing.joinToString()}"
}
}
android {
namespace = "de.softwareapp_hb.fotodup.finder"
compileSdk = 36
defaultConfig {
applicationId = "de.softwareapp_hb.fotodup.finder"
minSdk = 26
targetSdk = 36
versionCode = 3
versionName = "1.0.2"
vectorDrawables {
useSupportLibrary = true
}
}
signingConfigs {
if (hasReleaseSigning) {
create("release") {
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keystoreProperties.getProperty("keyAlias")
// Falls back to the store password. That matches reality: PKCS12
// keystores (the default on modern JDKs) cannot have a key password
// that differs from the store password, and leaving this null makes
// AGP's signReleaseBundle crash with an NPE.
keyPassword = keystoreProperties.getProperty("keyPassword")
?: keystoreProperties.getProperty("storePassword")
}
}
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
versionNameSuffix = "-debug"
}
release {
if (hasReleaseSigning) {
signingConfig = signingConfigs.getByName("release")
}
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
compose = true
}
testOptions {
unitTests {
// Robolectric needs the merged resources and manifest to stand up the framework.
isIncludeAndroidResources = true
}
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
lint {
// Dependency versions are pinned deliberately — Compose 1.12+/Coil 3.6+ need
// compileSdk 37, which AGP 9.1 does not support yet (see the README version
// note). These advisories are noise rather than signal here.
disable += setOf(
"GradleDependency",
"AndroidGradlePluginVersion",
"NewerVersionAvailable",
)
}
}
kotlin {
compilerOptions {
// With AGP built-in Kotlin this already defaults to
// android.compileOptions.targetCompatibility; set explicitly for clarity.
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
// `java.awt` is used by the similarity benchmark (headless), and the benchmark itself is
// opt-in. Gradle's -D only reaches the Gradle JVM, so the flags are forwarded explicitly.
// Run it with:
// ./gradlew :app:testDebugUnitTest --tests '*SimilarityBenchmarkTest*' -DfotoBench=true
tasks.withType<Test>().configureEach {
systemProperty("java.awt.headless", "true")
// Robolectric reflects into JDK internals (notably java.io.FileDescriptor), which the module
// system blocks from JDK 17 onwards. Without these it fails with "Failed to interact with raw
// FileDescriptor internals".
jvmArgs(
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.text=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
// Robolectric reaches FileDescriptor internals through jdk.internal.access.SharedSecrets, and
// that needs an *export* rather than an *open*: without it the run dies with
// "IllegalAccessException ... module java.base does not export jdk.internal.access".
"--add-exports=java.base/jdk.internal.access=ALL-UNNAMED",
"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
"--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED",
)
systemProperty("fotoBench", providers.systemProperty("fotoBench").orNull ?: "false")
providers.systemProperty("fotoBench.dir").orNull?.let { systemProperty("fotoBench.dir", it) }
providers.systemProperty("fotoBench.count").orNull?.let { systemProperty("fotoBench.count", it) }
providers.systemProperty("fotoBench.scenes").orNull?.let { systemProperty("fotoBench.scenes", it) }
providers.systemProperty("fotoBench.density").orNull?.let { systemProperty("fotoBench.density", it) }
providers.systemProperty("fotoBench.max").orNull?.let { systemProperty("fotoBench.max", it) }
providers.systemProperty("fotoLocal.dir").orNull?.let { systemProperty("fotoLocal.dir", it) }
providers.systemProperty("fotoScale").orNull?.let { systemProperty("fotoScale", it) }
// Real-photo runs hold hundreds of decoded images in memory at once.
maxHeapSize = "2g"
testLogging { showStandardStreams = true }
}
dependencies {
implementation(libs.androidx.core.ktx)
// EXIF orientation, so a photo hashes the same whichever decode path served it.
implementation(libs.androidx.exifinterface)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.graphics)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons.core)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.coil.compose)
debugImplementation(libs.androidx.compose.ui.tooling)
testImplementation(libs.junit)
// Runs the real Android framework on the JVM, so the data layer is testable without a device.
testImplementation(libs.robolectric)
}