【问题标题】:Smack 4.1.8 Failed resolution of: Lorg/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration;Smack 4.1.8 解析失败: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 文件夹中,但得到了同样的错误。

【问题讨论】:

    标签: smack


    【解决方案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"
      

      【讨论】:

        猜你喜欢
        • 2015-08-14
        • 1970-01-01
        • 1970-01-01
        • 2015-09-24
        • 1970-01-01
        • 2018-10-31
        • 1970-01-01
        • 1970-01-01
        • 2018-02-25
        相关资源
        最近更新 更多