diff --git a/android/app/build.gradle b/android/app/build.gradle index 0671ab6bd..18dfda713 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -22,19 +22,19 @@ buildscript { googleFirebaseServicesDefault dependencies { - classpath 'com.android.tools.build:gradle:8.7.3' + classpath libs.android.tools if (googleFirebaseServicesEnabled) { println('Building with Google Firebase Services') - classpath 'com.google.gms:google-services:4.4.2' - classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2' - classpath 'com.google.firebase:firebase-appdistribution-gradle:5.0.0' + classpath libs.google.services + classpath libs.google.firebase.crashlytics + classpath libs.google.firebase.appdistribution } else { println('Building without Google Firebase Services') } - classpath('com.github.triplet.gradle:play-publisher:3.10.1') - classpath('ru.cian:huawei-publish-gradle-plugin:1.4.2') + classpath(libs.triplet.play.publisher) + classpath(libs.huawei.publish) } } @@ -366,7 +366,7 @@ android { } dependencies { - coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4' + coreLibraryDesugaring libs.android.tools.desugar // Google Play Location Services // @@ -377,17 +377,17 @@ dependencies { // ls -la src/$flavor/java/app/organicmaps/location/GoogleFusedLocationProvider.java // ``` // - webImplementation 'com.google.android.gms:play-services-location:21.3.0' - googleImplementation 'com.google.android.gms:play-services-location:21.3.0' - huaweiImplementation 'com.google.android.gms:play-services-location:21.3.0' + webImplementation libs.google.services.location + googleImplementation libs.google.services.location + huaweiImplementation libs.google.services.location // This is the microG project's re-implementation which is permissible on // F-droid because it's Apache-2.0. - fdroidImplementation 'org.microg.gms:play-services-location:0.3.6.244735' + fdroidImplementation libs.microg.services.location // Google Firebase Services if (googleFirebaseServicesEnabled) { // Import the BoM for the Firebase platform - implementation platform('com.google.firebase:firebase-bom:33.5.1') + implementation platform(libs.google.firebase.bom) // Add the dependencies for the Crashlytics and Analytics libraries // When using the BoM, you don't specify versions in Firebase library dependencies implementation 'com.google.firebase:firebase-crashlytics' @@ -398,30 +398,30 @@ dependencies { // > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable // We don't use Kotlin, but some dependencies are actively using it. // See https://stackoverflow.com/a/75719642 - implementation 'androidx.core:core:1.15.0' - implementation(platform('org.jetbrains.kotlin:kotlin-bom:2.1.10')) - implementation 'androidx.annotation:annotation:1.9.1' - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'androidx.car.app:app:1.7.0-rc01' - implementation 'androidx.car.app:app-projected:1.7.0-rc01' - implementation 'androidx.constraintlayout:constraintlayout:2.2.0' - implementation 'androidx.fragment:fragment:1.8.5' - implementation 'androidx.preference:preference:1.2.1' - implementation 'androidx.recyclerview:recyclerview:1.3.2' - implementation 'androidx.work:work-runtime:2.10.0' - implementation 'androidx.lifecycle:lifecycle-process:2.8.7' - implementation 'com.google.android.material:material:1.12.0' + implementation libs.androidx.core + implementation(platform(libs.jetbrains.kotlin.bom)) + implementation libs.androidx.annotation + implementation libs.androidx.appcompat + implementation libs.androidx.car.app + implementation libs.androidx.car.app.projected + implementation libs.androidx.constraintlayout + implementation libs.androidx.fragment + implementation libs.androidx.preference + implementation libs.androidx.recyclerview + implementation libs.androidx.work.runtime + implementation libs.androidx.lifecycle.process + implementation libs.android.material // Fix for app/organicmaps/util/FileUploadWorker.java:14: error: cannot access ListenableFuture // https://github.com/organicmaps/organicmaps/issues/6106 - implementation 'com.google.guava:guava:33.3.0-android' - implementation 'com.github.devnullorthrow:MPAndroidChart:3.2.0-alpha' - implementation 'net.jcip:jcip-annotations:1.0' + implementation libs.google.guava + implementation libs.devnullorthrow.mpandroidchart + implementation libs.jcip.annotations // Test Dependencies - androidTestImplementation 'androidx.test.ext:junit:1.2.1' - testImplementation 'junit:junit:4.13.2' - testImplementation 'org.mockito:mockito-core:5.15.2' - testImplementation 'org.mockito:mockito-inline:5.2.0' + androidTestImplementation libs.androidx.test.junit + testImplementation libs.junit + testImplementation libs.mockito.core + testImplementation libs.mockito.inline } tasks.withType(JavaCompile) { diff --git a/android/build.gradle b/android/build.gradle index 26e293ae5..6fd74f483 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.7.3' apply false - id 'com.android.library' version '8.7.3' apply false + alias libs.plugins.android.application apply false + alias libs.plugins.android.library apply false } diff --git a/android/gradle/libs.versions.toml b/android/gradle/libs.versions.toml new file mode 100644 index 000000000..76c4a2a35 --- /dev/null +++ b/android/gradle/libs.versions.toml @@ -0,0 +1,39 @@ +[versions] +androidGradlePlugin = "8.7.3" +androidxCarApp = "1.7.0-rc01" + +[libraries] +android-tools = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" } +google-services = { module = "com.google.gms:google-services", version = "4.4.2" } +google-firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-gradle", version = "3.0.2" } +google-firebase-appdistribution = { module = "com.google.firebase:firebase-appdistribution-gradle", version = "5.0.0" } +triplet-play-publisher = { module = "com.github.triplet.gradle:play-publisher", version = "3.10.1" } +huawei-publish = { module = "ru.cian:huawei-publish-gradle-plugin", version = "1.4.2" } +android-tools-desugar = { module = "com.android.tools:desugar_jdk_libs", version = "2.1.4" } +google-services-location = { module = "com.google.android.gms:play-services-location", version = "21.3.0" } +microg-services-location = { module = "org.microg.gms:play-services-location", version = "0.3.6.244735" } +google-firebase-bom = { module = "com.google.firebase:firebase-bom", version = "33.5.1" } +androidx-core = { module = "androidx.core:core", version = "1.15.0" } +jetbrains-kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version = "2.1.10" } +androidx-annotation = { module = "androidx.annotation:annotation", version = "1.9.1" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.0" } +androidx-car-app = { module = "androidx.car.app:app", version.ref = "androidxCarApp" } +androidx-car-app-projected = { module = "androidx.car.app:app-projected", version.ref = "androidxCarApp" } +androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version = "2.2.0" } +androidx-fragment = { module = "androidx.fragment:fragment", version = "1.8.5" } +androidx-preference = { module = "androidx.preference:preference", version = "1.2.1" } +androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.3.2" } +androidx-work-runtime = { module = "androidx.work:work-runtime", version = "2.10.0" } +androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version = "2.8.7" } +android-material = { module = "com.google.android.material:material", version = "1.12.0" } +google-guava = { module = "com.google.guava:guava", version = "33.3.0-android" } +devnullorthrow-mpandroidchart = { module = "com.github.devnullorthrow:MPAndroidChart", version = "3.2.0-alpha" } +jcip-annotations = { module = "net.jcip:jcip-annotations", version = "1.0" } +androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.2.1" } +junit = { module = "junit:junit", version = "4.13.2" } +mockito-core = { module = "org.mockito:mockito-core", version = "5.15.2" } +mockito-inline = { module = "org.mockito:mockito-inline", version = "5.2.0" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +android-library= { id = "com.android.library", version.ref = "androidGradlePlugin" }