我正在尝试在我的项目中使用 org.reflections 库。我将其添加到我的 gradle 依赖项列表中,但是当我运行代码时,我得到以下内容:
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x.
java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
我理解这是因为我的依赖项之一在内部使用了更高版本的 slf4j,该版本与 org.reflections 正在使用的版本不兼容。
我看到一条建议,确保最后包含旧版本的 jar。我怎样才能在 Gradle 中做到这一点,或者还有其他解决方案H
最佳答案
尝试这样:
compile (group: 'org.reflections', name: 'reflections', version: '0.9.10'){
exclude group : "org.slf4j"
}
从 org.reflections
依赖项中排除 slf4j
。
关于java - slf4j版本不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48997679/