我正在使用4.1.8库构建一个Smack客户端。代码编译得很好。当我运行时,应用程序崩溃并显示错误:由: Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;引起: java.lang.NoClassDefFoundError:解析失败
我的导入行:
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'}项目gradle
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文件夹中,但得到了相同的错误。
发布于 2017-11-24 18:13:37
你需要在你的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"发布于 2017-07-28 23:06:31
尝试修改您的依赖关系:
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"https://stackoverflow.com/questions/40200021
复制相似问题