Smack throws “NoClassDefFoundError: Failed resolution of: Lorg/jxmpp/util/XmppStringUtils”

荒凉一梦 提交于 2019-11-30 20:31:19
Flow

From NoClassDefFoundError's javadoc:

Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

Java uses dynamic linking, which means that the symbols (class names, ...) are linked when first used. As Mohit already pointed out, it appears you are missing the JXMPP library, which is a (transitive) dependency of Smack. I assume you did add Smack to your project by simply putting it into the libs/ folder. This approach is not recommended, as you easily miss a trasitive dependency of Smack, like it happened to you. Instead use a build system which is able to resolve those dependencies like Maven or Gradle. See also:

You required four extra jar files.

1) jxmpp-core.jar

2) jxmpp-jid.jar

3) jxmpp-stringprep-libidn

4) jxmpp-util-cache

You can download all of them from below link.

https://oss.sonatype.org/content/repositories/releases/org/jxmpp/

The issue comes from one dependency de.measite.minidns that pushed a update with a bug. So I fixed it like that by excluding to auto-dependency and including the last stable release. It fixed my problem.

compile('org.igniterealtime.smack:smack-android-extensions:4.2.0') {
    exclude group: 'de.measite.minidns'
}
compile('org.igniterealtime.smack:smack-tcp:4.2.0') {
    exclude group: 'de.measite.minidns'
}
compile group: 'de.measite.minidns', name: 'minidns-hla', version: '0.2.2'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!