集成JGit至Android项目遭遇依赖重复类错误求助
JGit集成Android时的重复类依赖问题
将JGit集成到Android项目时,出现大量由JGit传递依赖引发的重复类错误,检测到的重复类如下:
- org/apache/sshd/common/util/closeable/SequentialCloseable.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/closeable/SimpleCloseable.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/functors/Int2IntFunction.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/functors/UnaryEquator.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/helper/LazyIterablesConcatenator$1.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/helper/LazyIterablesConcatenator.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/helper/LazyMatchingTypeIterable.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/helper/LazyMatchingTypeIterator.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar] - org/apache/sshd/common/util/io/CloseableEmptyInputStream.class is in [sshd-osgi-2.7.0.jar, sshd-common-2.7.0.jar]
执行gradle dependencies命令后发现,sshd-osgi-2.7.0.jar与sshd-common-2.7.0.jar均来自org.eclipse.jgit:org.eclipse.jgit.ssh.apache依赖,依赖树片段如下:
| +--- org.eclipse.jgit:org.eclipse.jgit.ssh.apache:5.13.1.202206130422-r | | +--- org.eclipse.jgit:org.eclipse.jgit:5.13.1.202206130422-r (*) | | +--- org.apache.sshd:sshd-osgi:2.7.0 | | | +--- org.slf4j:slf4j-api:1.7.30 | | | \--- org.slf4j:jcl-over-slf4j:1.7.30 | | | \--- org.slf4j:slf4j-api:1.7.30 | | +--- org.apache.sshd:sshd-sftp:2.7.0 | | | +--- org.apache.sshd:sshd-core:2.7.0 | | | | +--- org.apache.sshd:sshd-common:2.7.0
请问是操作存在疏漏,还是该常用包的依赖本身存在重复类问题,导致无法直接在Android平台使用?
内容的提问来源于stack exchange,提问作者user7858768
相关产品推荐
相关产品推荐

