Put deps into version catalog
MODIFY
gradle/libs.versions.toml
gradle/libs.versions.toml
kotlinCompiler = "1.4.21"
kotlinLib = "1.3.72"
androidXTest = "1.1.0"
+androidXJunit = "1.1.3"
workManager = "2.7.0"
[libraries]
@@ -37,11 +38,14 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref =
# and they'll automatically resolve to higher version without having to necessarily resort to a
# resolution strategy.
androidX-fragment = { module = "androidx.fragment:fragment", version = "1.0.0" }
-androidX-test-core = { module = "androidx.test:core", version = "1.0.0" }
+androidX-test-core = { module = "androidx.test:core", version = "1.4.0" }
androidX-test-rules = { module = "androidx.test:rules", version.ref = "androidXTest" }
-androidX-test-runner = { module = "androidx.test:runner", version.ref = "androidXTest" }
-androidX-test-orchestrator = { module = "androidx.test:orchestrator", version.ref = "androidXTest" }
-androidX-test-espresso = { module = "androidx.test.espresso:espresso-core", version = "3.1.0" }
+# Exposed transitively, avoid increasing
+androidX-test-runner = { module = "androidx.test:runner", version = "1.1.0" }
+androidX-test-orchestrator = { module = "androidx.test:orchestrator", version = "1.4.1" }
+androidX-test-espresso = { module = "androidx.test.espresso:espresso-core", version = "3.4.0" }
+androidX-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidXJunit" }
+androidX-test-junitKtx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidXJunit" }
androidX-work-runtime = { module = "androidx.work:work-runtime", version.ref = "workManager" }
androidX-work-multiprocess = { module = "androidx.work:work-multiprocess", version.ref = "workManager" }

MODIFY
leakcanary-android-sample/build.gradle
leakcanary-android-sample/build.gradle
@@ -32,7 +32,7 @@ dependencies {
androidTestImplementation libs.androidX.test.rules
androidTestImplementation libs.androidX.test.runner
androidTestImplementation libs.androidX.test.junit
- androidTestImplementation libs.androidX.test.junit_ktx
+ androidTestImplementation libs.androidX.test.junitKtx
androidTestUtil libs.androidX.test.orchestrator
}

Put deps into version catalog