Android: Update build configuration for Android 15

Update build configuration to support Android 15 (API 35) devices and
optimize build settings for better compatibility.
This commit is contained in:
Zephyron 2025-02-01 11:44:39 +10:00
parent 6ab82e8eeb
commit a96216ff35
No known key found for this signature in database
GPG key ID: 2177ADED8AC966AF
2 changed files with 23 additions and 27 deletions

View file

@ -1,8 +1,8 @@
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project // SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-FileCopyrightText: 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import android.annotation.SuppressLint import android.annotation.SuppressLint
import kotlin.collections.setOf
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
import com.github.triplet.gradle.androidpublisher.ReleaseStatus import com.github.triplet.gradle.androidpublisher.ReleaseStatus
@ -26,21 +26,22 @@ val autoVersion = (((System.currentTimeMillis() / 1000) - 1451606400) / 10).toIn
@Suppress("UnstableApiUsage") @Suppress("UnstableApiUsage")
android { android {
namespace = "org.citron.citron_emu" namespace = "org.citron.citron_emu"
compileSdk = 35
compileSdkVersion = "android-34" ndkVersion = "26.3.11579264"
ndkVersion = "27.2.12479018" // "27.2.12479018" // "28.0.12433566 rc1"// "28.0.12674087 rc2" // "26.1.10909125"
buildFeatures { buildFeatures {
viewBinding = true viewBinding = true
buildConfig = true
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_21 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_17
} }
kotlinOptions { kotlinOptions {
jvmTarget = "21" jvmTarget = "17"
} }
packaging { packaging {
@ -56,7 +57,7 @@ android {
// TODO If this is ever modified, change application_id in strings.xml // TODO If this is ever modified, change application_id in strings.xml
applicationId = "org.citron.citron_emu" applicationId = "org.citron.citron_emu"
minSdk = 30 minSdk = 30
targetSdk = 34 targetSdk = 35
versionName = getGitVersion() versionName = getGitVersion()
versionCode = if (System.getenv("AUTO_VERSIONED") == "true") { versionCode = if (System.getenv("AUTO_VERSIONED") == "true") {
@ -103,14 +104,12 @@ android {
signingConfigs.getByName("default") signingConfigs.getByName("default")
} }
resValue("string", "app_name_suffixed", "citron") resValue("string", "app_name_suffixed", "Citron")
isDefault = true isDefault = true
isShrinkResources = true
isMinifyEnabled = true isMinifyEnabled = true
isJniDebuggable = false
isDebuggable = false isDebuggable = false
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro" "proguard-rules.pro"
) )
} }
@ -118,12 +117,12 @@ android {
// builds a release build that doesn't need signing // builds a release build that doesn't need signing
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build. // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
register("relWithDebInfo") { register("relWithDebInfo") {
resValue("string", "app_name_suffixed", "citron Debug Release") resValue("string", "app_name_suffixed", "Citron Debug Release")
signingConfig = signingConfigs.getByName("default") signingConfig = signingConfigs.getByName("default")
isMinifyEnabled = true isMinifyEnabled = true
isDebuggable = true isDebuggable = true
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro" "proguard-rules.pro"
) )
versionNameSuffix = "-relWithDebInfo" versionNameSuffix = "-relWithDebInfo"
@ -135,7 +134,7 @@ android {
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build. // Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
debug { debug {
signingConfig = signingConfigs.getByName("default") signingConfig = signingConfigs.getByName("default")
resValue("string", "app_name_suffixed", "citron Debug") resValue("string", "app_name_suffixed", "Citron Debug")
isDebuggable = true isDebuggable = true
isJniDebuggable = true isJniDebuggable = true
versionNameSuffix = "-debug" versionNameSuffix = "-debug"
@ -148,7 +147,7 @@ android {
create("mainline") { create("mainline") {
isDefault = true isDefault = true
dimension = "version" dimension = "version"
buildConfigField("Boolean", "PREMIUM", "true") // Spoof EA Version buildConfigField("Boolean", "PREMIUM", "true")
} }
create("ea") { create("ea") {
@ -164,6 +163,7 @@ android {
path = file("../../../CMakeLists.txt") path = file("../../../CMakeLists.txt")
} }
} }
buildToolsVersion = "35.0.1"
defaultConfig { defaultConfig {
externalNativeBuild { externalNativeBuild {
@ -177,17 +177,18 @@ android {
"-DCITRON_USE_BUNDLED_VCPKG=ON", "-DCITRON_USE_BUNDLED_VCPKG=ON",
"-DCITRON_USE_BUNDLED_FFMPEG=ON", "-DCITRON_USE_BUNDLED_FFMPEG=ON",
"-DCITRON_ENABLE_LTO=ON", "-DCITRON_ENABLE_LTO=ON",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
) )
abiFilters("arm64-v8a") abiFilters("arm64-v8a", "x86_64")
} }
} }
} }
} }
tasks.create<Delete>("ktlintReset") { // Deprecated, Still Works. tasks.create<Delete>("ktlintReset") {
delete(File(buildDir.path + File.separator + "intermediates/ktLint")) delete(File(layout.buildDirectory.toString() + File.separator + "intermediates/ktLint"))
} }
val showFormatHelp = { val showFormatHelp = {
@ -204,13 +205,6 @@ ktlint {
version.set("0.47.1") version.set("0.47.1")
android.set(true) android.set(true)
ignoreFailures.set(false) ignoreFailures.set(false)
disabledRules.set( // Deprecated, Still Works.
setOf(
"no-wildcard-imports",
"package-name",
"import-ordering"
)
)
reporters { reporters {
reporter(ReporterType.CHECKSTYLE) reporter(ReporterType.CHECKSTYLE)
} }
@ -226,6 +220,7 @@ play {
} }
dependencies { dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0")
implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1") implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.recyclerview:recyclerview:1.3.1") implementation("androidx.recyclerview:recyclerview:1.3.1")

View file

@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project // SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-FileCopyrightText: 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.