我试图在项目中使用org.反射库。我将其添加到我的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.efflections使用的slf4J使用。
我看到了一个建议,以确保最后包含带有较旧版本的罐子。我该如何在gradle中做到这一点,还是有其他解决方案
以这种方式尝试:
compile (group: 'org.reflections', name: 'reflections', version: '0.9.10'){
exclude group : "org.slf4j"
}
从您的org.reflections
依赖项中排除slf4j
。