Files
BarisKeser-ByeDPI/app/build.gradle.kts
T
Barış Keser a92e074540 build: upgrade toolchain (AGP, Gradle, Kotlin, NDK) and AndroidX
- AGP 8.9.1 -> 8.13.2, Gradle 8.11.1 -> 8.14.7
- Kotlin 1.9.25 -> 2.4.21, kotlinOptions replaced by kotlin { compilerOptions }
- NDK 27.2.12479018 -> 28.2.13676358 (16 KB aligned by default)
- CI workflows: JDK 17 -> 21, NDK r28 install
- AndroidX: core-ktx 1.17.0, appcompat 1.8.0, activity-ktx 1.13.0,
  fragment-ktx 1.9.1, lifecycle 2.11.0, material 1.14.0,
  test ext junit 1.3.0, espresso 3.7.0
2026-11-13 02:08:42 +03:00

134 lines
4.4 KiB
Kotlin

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "com.bariskeser.byedpi"
compileSdk = 36
// Google Play requires 16 KB page-size support for apps with native code
// targeting Android 15+ (API 35+). r28+ aligns to 16 KB by default; the
// explicit linker flags (see Application.mk / CMakeLists.txt) are kept as a
// safeguard. Both build systems (CMake and ndk-build) resolve their toolchain
// from this version.
ndkVersion = "28.2.13676358"
defaultConfig {
applicationId = "com.bariskeser.byedpi"
minSdk = 24
targetSdk = 36
versionCode = (findProperty("appVersionCode") as String?)?.toIntOrNull() ?: 14
versionName = (findProperty("appVersionName") as String?) ?: "3.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters.add("armeabi-v7a")
abiFilters.add("arm64-v8a")
abiFilters.add("x86")
abiFilters.add("x86_64")
}
}
buildFeatures {
buildConfig = true
}
signingConfigs {
create("release") {
// Values come from environment variables (CI sets them from GitHub Secrets,
// or export them locally). Never hard-code keystore paths/passwords in VCS.
System.getenv("KEYSTORE_FILE")?.let { path ->
storeFile = file(path)
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
}
}
}
buildTypes {
release {
buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}\"")
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
// Signed only when a keystore is provided (CI with secrets); otherwise
// assembleRelease still succeeds and produces an unsigned APK.
signingConfig = System.getenv("KEYSTORE_FILE")?.let {
signingConfigs.getByName("release")
}
}
debug {
buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}-debug\"")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path = file("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
}
}
buildFeatures {
viewBinding = true
}
// https://android.izzysoft.de/articles/named/iod-scan-apkchecks?lang=en#blobs
dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
// Disables dependency metadata when building Android App Bundles.
includeInBundle = false
}
}
kotlin {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8)
}
}
dependencies {
implementation("androidx.fragment:fragment-ktx:1.9.1")
implementation("androidx.core:core-ktx:1.17.0")
implementation("androidx.appcompat:appcompat:1.8.0")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("com.takisoft.preferencex:preferencex:1.1.0")
implementation("com.google.android.material:material:1.14.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.11.0")
implementation("androidx.lifecycle:lifecycle-service:2.11.0")
implementation("androidx.activity:activity-ktx:1.13.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.11.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.3.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.7.0")
}
tasks.register<Exec>("runNdkBuild") {
group = "build"
val ndkDir = android.ndkDirectory
executable = if (System.getProperty("os.name").startsWith("Windows", ignoreCase = true)) {
"$ndkDir\\ndk-build.cmd"
} else {
"$ndkDir/ndk-build"
}
setArgs(listOf(
"NDK_PROJECT_PATH=build/intermediates/ndkBuild",
"NDK_LIBS_OUT=src/main/jniLibs",
"APP_BUILD_SCRIPT=src/main/jni/Android.mk",
"NDK_APPLICATION_MK=src/main/jni/Application.mk"
))
println("Command: $commandLine")
}
tasks.preBuild {
dependsOn("runNdkBuild")
}