【发布时间】: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 文件夹中,但得到了同样的错误。
【问题讨论】:
标签: smack