我正在使用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;
app 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'}
project 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文件夹中,但是得到了同样的错误。
答案 0 :(得分:1)
你需要在你的gradle中添加更多依赖项,它对我有用。
pair<T1,T2> p(rv1,rv2) // moving items individually
pair<T1,T2> p(rv) // moving complete pair
答案 1 :(得分:0)
尝试修改您的依赖关系:
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"