Smack 4.1.8 解析失败:Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;
Posted
技术标签:
【中文标题】Smack 4.1.8 解析失败:Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;【英文标题】:Smack 4.1.8 Failed resolution of: Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration; 【发布时间】:2016-10-23 05:55:38 【问题描述】:我正在使用 4.1.8 库构建 Smack 客户端。代码编译得很好。当我运行时,应用程序崩溃并出现错误: 原因:java.lang.NoClassDefFoundError:解析失败:Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;
我的导入行:
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smackx.iqregister.AccountManager;
应用 Gradle
dependencies
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile group: 'org.igniterealtime.smack', name: 'smack-extensions', version: '4.1.8'
compile group: 'org.igniterealtime.smack', name: 'smack-java7', version: '4.1.8'
compile group: 'org.igniterealtime.smack', name: 'smack-tcp', version: '4.1.8'
compile group: 'org.igniterealtime.smack', name: 'smack-core', version: '4.1.8'
项目分级
dependencies
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
我也尝试将 smack 文件放在 lib 文件夹中,但得到了同样的错误。
【问题讨论】:
【参考方案1】:你需要在你的 gradle 中添加更多的依赖,它对我有用。
compile "org.igniterealtime.smack:smack-android:4.1.8"
compile "org.igniterealtime.smack:smack-tcp:4.1.8"
compile "org.igniterealtime.smack:smack-core:4.1.8"
compile "org.igniterealtime.smack:smack-im:4.1.8"
compile "org.jxmpp:jxmpp-jid:0.5.0-alpha6"
compile "org.igniterealtime.smack:smack-extensions:4.1.8"
【讨论】:
【参考方案2】:尝试修改你的依赖:
compile "org.igniterealtime.smack:smack-android-extensions:4.1.8"
compile "org.igniterealtime.smack:smack-android:4.1.8"
compile "org.igniterealtime.smack:smack-tcp:4.1.8"
【讨论】:
以上是关于Smack 4.1.8 解析失败:Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;的主要内容,如果未能解决你的问题,请参考以下文章
带有 Smack 4.1.8 客户端库的 Apache Vysper - 如何处理 TLS 证书?
通过 Gradle 从 maven 下载 smack4.1 失败