logback-android icon indicating copy to clipboard operation
logback-android copied to clipboard

Missing transitive dependency on slf4j-api-2.x

Open xdevl opened this issue 2 years ago • 0 comments

Describe the bug

Depending on a lib that depends on slf4j-api-1.x causes the following crash:

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.slf4j.spi.SLF4JServiceProvider" on path: DexPathList[...]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388) 

logback-android should therefore declare a transitive dependency on slf4j-api-2.x in the same way it is done in slf4j-nop for example:

$ gradlew dependencies
...
+--- com.github.tony19:logback-android:2.0.1
+--- org.slf4j:slf4j-nop:3.0.0
 |    \--- org.slf4j:slf4j-api:2.0.7
...

Reproduction

With a Gradle project depending on logback-android run ./gradlew dependencies and observe the tree

Logs

No response

logback-android version

3.0.0

OS Version

11

What logback configuration are you using? (logback.xml or Java/Kotlin code)

Kotlin code

Validations

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

xdevl avatar Aug 26 '23 23:08 xdevl