Android Studio now bundles JBR 25, which Gradle 8.14's embedded Kotlin can't parse. Follow Tauri's current template: Gradle 9.6.1, Kotlin 2.2.10, the builtInKotlin/newDsl/failOnMissingFiles compatibility flags, the compilerOptions DSL, and ExecOperations in BuildTask (project.exec is gone in Gradle 9). AGP goes to 9.4.1 rather than the template's 9.3.1. Release lint vital is turned off: AGP 9.3/9.4's lint crashes analysing the .gradle.kts scripts (findFirCompiledSymbol), failing every release build. The env scripts now accept JDK 17 through 25, preferring Studio's JBR.
110 lines
3.6 KiB
Kotlin
110 lines
3.6 KiB
Kotlin
import java.io.FileInputStream
|
|
import java.util.Properties
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
id("org.jetbrains.kotlin.android")
|
|
id("rust")
|
|
}
|
|
|
|
val tauriProperties = Properties().apply {
|
|
val propFile = file("tauri.properties")
|
|
if (propFile.exists()) {
|
|
propFile.inputStream().use { load(it) }
|
|
}
|
|
}
|
|
|
|
// Release signing key, written by `scripts/fdroid-publish.sh --init-keystore`.
|
|
// Without it, release builds come out unsigned as before.
|
|
val keystoreProperties = Properties().apply {
|
|
val propFile = rootProject.file("keystore.properties")
|
|
if (propFile.exists()) {
|
|
FileInputStream(propFile).use { load(it) }
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdk = 36
|
|
namespace = "com.garrettmills.mtgc"
|
|
defaultConfig {
|
|
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
|
applicationId = "com.garrettmills.mtgc"
|
|
minSdk = 24
|
|
targetSdk = 36
|
|
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
|
|
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
|
|
}
|
|
signingConfigs {
|
|
if (!keystoreProperties.isEmpty) {
|
|
create("release") {
|
|
storeFile = file(keystoreProperties.getProperty("storeFile"))
|
|
storePassword = keystoreProperties.getProperty("password")
|
|
keyAlias = keystoreProperties.getProperty("keyAlias")
|
|
keyPassword = keystoreProperties.getProperty("password")
|
|
}
|
|
}
|
|
}
|
|
buildTypes {
|
|
getByName("debug") {
|
|
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
|
isDebuggable = true
|
|
isJniDebuggable = true
|
|
isMinifyEnabled = false
|
|
packaging { jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
|
|
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
|
|
jniLibs.keepDebugSymbols.add("*/x86/*.so")
|
|
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
|
|
}
|
|
}
|
|
getByName("release") {
|
|
signingConfigs.findByName("release")?.let { signingConfig = it }
|
|
isMinifyEnabled = true
|
|
proguardFiles(
|
|
*fileTree(".") {
|
|
include("**/*.pro")
|
|
exclude("build/**")
|
|
}
|
|
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
|
.toList().toTypedArray()
|
|
)
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
buildFeatures {
|
|
buildConfig = true
|
|
}
|
|
// AGP 9.3/9.4's lint crashes analysing the .gradle.kts scripts
|
|
// ("findFirCompiledSymbol only works on compiled declarations"), which
|
|
// fails every release build. Skip the release-time lint pass until a
|
|
// newer AGP fixes it.
|
|
lint {
|
|
checkReleaseBuilds = false
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget = JvmTarget.JVM_1_8
|
|
}
|
|
}
|
|
|
|
rust {
|
|
rootDirRel = "../../../"
|
|
}
|
|
|
|
dependencies {
|
|
implementation("androidx.webkit:webkit:1.14.0")
|
|
implementation("androidx.appcompat:appcompat:1.7.1")
|
|
implementation("androidx.activity:activity-ktx:1.10.1")
|
|
implementation("com.google.android.material:material:1.12.0")
|
|
implementation("androidx.lifecycle:lifecycle-process:2.10.0")
|
|
testImplementation("junit:junit:4.13.2")
|
|
androidTestImplementation("androidx.test.ext:junit:1.1.4")
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
|
|
}
|
|
|
|
apply(from = "tauri.build.gradle.kts") |