From 9dd6ebf21eea5a92fa6b55d372732117acbd6ec5 Mon Sep 17 00:00:00 2001 From: Joseph Sanjaya Date: Mon, 25 Aug 2025 19:52:10 +0700 Subject: [PATCH] fix(#223): fix issue on test environment SLF4J + agent warnings in test env - Added `slf4j-android` as a test dependency to provide a proper SLF4J binding and avoid "StaticLoggerBinder" warnings. - Configured JVM args for Gradle test tasks to enable dynamic agent loading, suppressing Byte Buddy agent warnings during test runs. --- app/build.gradle.kts | 8 +++++++- gradle/libs.versions.toml | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index aac3d3e6..d62e606b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -245,12 +245,14 @@ dependencies { testImplementation(libs.junit) testImplementation(libs.mockk) testImplementation(libs.turbine) + testImplementation(libs.slf4j.android) testImplementation(libs.kotlinx.coroutines.tests) androidTestImplementation(platform(libs.androidx.compose.bom)) androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(libs.bundles.android.test) androidTestImplementation(libs.fastlane.screengrab) + androidTestImplementation(libs.slf4j.android) } val ktlintCheck by tasks.registering(JavaExec::class) { @@ -283,4 +285,8 @@ tasks.register("ktlintFormat") { "**.kts", "!**/build/**", ) -} \ No newline at end of file +} + +tasks.withType { + jvmArgs("-XX:+EnableDynamicAgentLoading") +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f18f2b70..a0f2aba6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,6 +35,7 @@ koin-annotation-bom = "2.1.0" ksp = "2.0.0-1.0.24" turbine = "1.2.1" coroutines = "1.10.2" +slf4j = "1.7.36" [libraries] androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core-ktx" } @@ -122,6 +123,7 @@ koin-annotation-compiler = { module = "io.insert-koin:koin-ksp-compiler", versio turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } kotlinx-coroutines-tests = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } +slf4j-android = { module = "org.slf4j:slf4j-android", version.ref = "slf4j" } [bundles] androidx-lifecycle = ["androidx-lifecycle-runtime", "androidx-lifecycle-viewmodel", "androidx-lifecycle-viewmodel-compose"]