Android: Use version catalog and update dependencies

Migrate plugin and dependency versions to a Gradle version catalog and update dependencies to their latest available versions.
This commit is contained in:
Simonx22 committed 2026-03-21 10:50:34 -04:00
1 parent 8ac767e032
commit e878174235
8 files changed
+103 -60

No files matched your search

+27 -35
View File
@@ -1,20 +1,18 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
id("com.android.application") alias(libs.plugins.android.application)
id("org.jetbrains.kotlin.android") alias(libs.plugins.kotlin.serialization)
kotlin("plugin.serialization") version "2.2.21" alias(libs.plugins.androidx.baselineprofile)
id("androidx.baselineprofile")
} }
@Suppress("UnstableApiUsage") @Suppress("UnstableApiUsage")
android { android {
compileSdkVersion = "android-36" compileSdk = 36
ndkVersion = "29.0.14206865" ndkVersion = "29.0.14206865"
buildFeatures { buildFeatures {
viewBinding = true viewBinding = true
buildConfig = true buildConfig = true
resValues = true
} }
compileOptions { compileOptions {
@@ -25,12 +23,6 @@ android {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
kotlin {
compilerOptions {
jvmTarget = JvmTarget.fromTarget("17")
}
}
lint { lint {
// This is important as it will run lint but not abort on error // This is important as it will run lint but not abort on error
// Lint has some overly obnoxious "errors" that should really be warnings // Lint has some overly obnoxious "errors" that should really be warnings
@@ -79,7 +71,7 @@ android {
isMinifyEnabled = true isMinifyEnabled = true
isShrinkResources = true isShrinkResources = true
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"
) )
} }
@@ -126,38 +118,38 @@ android {
dependencies { dependencies {
baselineProfile(project(":benchmark")) baselineProfile(project(":benchmark"))
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation("androidx.core:core-ktx:1.17.0") implementation(libs.androidx.core.ktx)
implementation("androidx.appcompat:appcompat:1.7.1") implementation(libs.androidx.appcompat)
implementation("androidx.cardview:cardview:1.0.0") implementation(libs.androidx.cardview)
implementation("androidx.recyclerview:recyclerview:1.4.0") implementation(libs.androidx.recyclerview)
implementation("androidx.constraintlayout:constraintlayout:2.2.1") implementation(libs.androidx.constraintlayout)
implementation("androidx.fragment:fragment-ktx:1.8.9") implementation(libs.androidx.fragment.ktx)
implementation("androidx.slidingpanelayout:slidingpanelayout:1.2.0") implementation(libs.androidx.slidingpanelayout)
implementation("com.google.android.material:material:1.13.0") implementation(libs.material)
implementation("androidx.core:core-splashscreen:1.2.0") implementation(libs.androidx.core.splashscreen)
implementation("androidx.preference:preference-ktx:1.2.1") implementation(libs.androidx.preference.ktx)
implementation("androidx.profileinstaller:profileinstaller:1.4.1") implementation(libs.androidx.profileinstaller)
// Kotlin extensions for lifecycle components // Kotlin extensions for lifecycle components
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.4") implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.9.4") implementation(libs.androidx.lifecycle.runtime.ktx)
// Android TV UI libraries. // Android TV UI libraries.
implementation("androidx.leanback:leanback:1.2.0") implementation(libs.androidx.leanback)
implementation("androidx.tvprovider:tvprovider:1.1.0") implementation(libs.androidx.tvprovider)
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") implementation(libs.androidx.swiperefreshlayout)
// For loading game covers from disk and GameTDB // For loading game covers from disk and GameTDB
implementation("io.coil-kt:coil:2.7.0") implementation(libs.coil)
// For loading custom GPU drivers // For loading custom GPU drivers
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0") implementation(libs.kotlinx.serialization.json)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2") implementation(libs.kotlinx.coroutines.android)
implementation("com.nononsenseapps:filepicker:4.2.1") implementation(libs.filepicker)
} }
fun getGitVersion(): String { fun getGitVersion(): String {
+9 -17
View File
@@ -1,37 +1,29 @@
import com.android.build.api.dsl.ManagedVirtualDevice import com.android.build.api.dsl.ManagedVirtualDevice
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
id("com.android.test") alias(libs.plugins.android.test)
id("org.jetbrains.kotlin.android") alias(libs.plugins.androidx.baselineprofile)
id("androidx.baselineprofile")
} }
android { android {
namespace = "org.dolphinemu.baselineprofile" namespace = "org.dolphinemu.baselineprofile"
compileSdk = 34 compileSdk = 36
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
kotlin {
compilerOptions {
jvmTarget = JvmTarget.fromTarget("17")
}
}
defaultConfig { defaultConfig {
minSdk = 28 minSdk = 28
targetSdk = 34 targetSdk = 36
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
targetProjectPath = ":app" targetProjectPath = ":app"
testOptions.managedDevices.devices { testOptions.managedDevices.allDevices {
create<ManagedVirtualDevice>("pixel6Api31") { create<ManagedVirtualDevice>("pixel6Api31") {
device = "Pixel 6" device = "Pixel 6"
apiLevel = 31 apiLevel = 31
@@ -48,8 +40,8 @@ baselineProfile {
} }
dependencies { dependencies {
implementation("androidx.test.ext:junit:1.3.0") implementation(libs.androidx.junit)
implementation("androidx.test.espresso:espresso-core:3.7.0") implementation(libs.androidx.espresso.core)
implementation("androidx.test.uiautomator:uiautomator:2.3.0") implementation(libs.androidx.uiautomator)
implementation("androidx.benchmark:benchmark-macro-junit4:1.4.1") implementation(libs.androidx.benchmark.macro.junit4)
} }
+4 -5
View File
@@ -1,10 +1,9 @@
// 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.
plugins { plugins {
id("com.android.application") version "8.13.1" apply false alias(libs.plugins.android.application) apply false
id("com.android.library") version "8.13.1" apply false alias(libs.plugins.android.library) apply false
id("org.jetbrains.kotlin.android") version "2.2.21" apply false alias(libs.plugins.android.test) apply false
id("com.android.test") version "8.13.1" apply false alias(libs.plugins.androidx.baselineprofile) apply false
id("androidx.baselineprofile") version "1.3.3" apply false
} }
buildscript { buildscript {
-1
View File
@@ -15,4 +15,3 @@ android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete": # Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
android.nonTransitiveRClass=false android.nonTransitiveRClass=false
android.nonFinalResIds=false
+61
View File
@@ -0,0 +1,61 @@
[versions]
agp = "9.1.0"
appcompat = "1.7.1"
benchmarkMacroJunit4 = "1.5.0-alpha04"
cardview = "1.0.0"
coil = "2.7.0"
constraintlayout = "2.2.1"
coreKtx = "1.18.0"
coreSplashscreen = "1.2.0"
desugar_jdk_libs = "2.1.5"
espressoCore = "3.7.0"
filepicker = "4.2.1"
fragmentKtx = "1.8.9"
junit = "1.3.0"
kotlin = "2.3.20"
kotlinxCoroutinesAndroid = "1.10.2"
kotlinxSerializationJson = "1.10.0"
leanback = "1.2.0"
lifecycle = "2.10.0"
material = "1.13.0"
preferenceKtx = "1.2.1"
profileinstaller = "1.4.1"
recyclerview = "1.4.0"
slidingpanelayout = "1.2.0"
swiperefreshlayout = "1.2.0"
tvprovider = "1.1.0"
uiautomator = "2.3.0"
[libraries]
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
androidx-benchmark-macro-junit4 = { group = "androidx.benchmark", name = "benchmark-macro-junit4", version.ref = "benchmarkMacroJunit4" }
androidx-cardview = { group = "androidx.cardview", name = "cardview", version.ref = "cardview" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "coreSplashscreen" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragmentKtx" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junit" }
androidx-leanback = { group = "androidx.leanback", name = "leanback", version.ref = "leanback" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" }
androidx-lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
androidx-preference-ktx = { group = "androidx.preference", name = "preference-ktx", version.ref = "preferenceKtx" }
androidx-profileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "profileinstaller" }
androidx-recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerview" }
androidx-slidingpanelayout = { group = "androidx.slidingpanelayout", name = "slidingpanelayout", version.ref = "slidingpanelayout" }
androidx-swiperefreshlayout = { group = "androidx.swiperefreshlayout", name = "swiperefreshlayout", version.ref = "swiperefreshlayout" }
androidx-tvprovider = { group = "androidx.tvprovider", name = "tvprovider", version.ref = "tvprovider" }
androidx-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "uiautomator" }
coil = { group = "io.coil-kt", name = "coil", version.ref = "coil" }
desugar_jdk_libs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
filepicker = { group = "com.nononsenseapps", name = "filepicker", version.ref = "filepicker" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
android-test = { id = "com.android.test", version.ref = "agp" }
androidx-baselineprofile = { id = "androidx.baselineprofile", version.ref = "benchmarkMacroJunit4" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
+1 -1
View File
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.