1

Vor einer Woche begann ich Chat-System zu meiner App implementieren mit Smack API (4.1.8-Version). Und es funktioniert auch gut auf Lolipop Gerät und Marshmallow. Aber auf Kitkat (API 19) Ich erhalte Ausnahme NoClassDefFoundError LogCat:NoClassDefFoundError: org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration nur API 19

Process: mobi, PID: 23510 
    java.lang.NoClassDefFoundError: org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration 
    at mobi.networking.ChatXMPPConnection.connect(ChatXMPPConnection.java:76) 
    at mobi.networking.ChatXMPPService.initConnection(ChatXMPPService.java:80) 
    at mobi.networking.ChatXMPPService.access$100(ChatXMPPService.java:36) 
    at mobi.networking.ChatXMPPService$1.run(ChatXMPPService.java:112) 
    at java.lang.Thread.run(Thread.java:841) 

Also was ist es auf der Linie 76 (die erste Zeile):

XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder(); 
     configBuilder.setUsernameAndPassword(mUsername, mPassword); 
     configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled); 
     configBuilder.setResource("Android"); 
     configBuilder.setServiceName(DOMAIN); 
     configBuilder.setHost(HOST); 
     configBuilder.setPort(PORT); 

Mein Build-gradle:

apply plugin: 'com.android.application' 
apply plugin: 'com.neenbedankt.android-apt' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.3" 
    dataBinding 
      { 
       enabled = true 
      } 

    defaultConfig { 
     applicationId "mobi" 
     minSdkVersion 19 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    allprojects { 
     repositories { 
      maven { url "https://jitpack.io" } 
      maven { url "https://oss.sonatype.org/content/repositories/snapshots" } 
      mavenCentral() 

     } 

    } 

    dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     testCompile 'junit:junit:4.12' 
     compile 'com.android.support:appcompat-v7:24.0.1' 
     compile 'com.android.support:design:24.0.1' 
     compile 'de.hdodenhof:circleimageview:2.1.0' 
     compile 'com.google.android.gms:play-services-appindexing:9.8.0' 
     compile 'com.android.support:recyclerview-v7:24.0.1' 
     compile 'com.zaihuishou:expandablerecycleradapter-databinding:1.0.0' 
     compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-SNAPSHOT' 
     compile 'com.kyleduo.switchbutton:library:1.4.1' 
     compile 'info.hoang8f:android-segmented:1.0.6' 
     compile 'com.github.Kennyc1012:BottomSheet:2.3.1' 
     compile 'com.aurelhubert:ahbottomnavigation:1.3.3' 
     compile 'com.vk:androidsdk:1.6.5' 
     compile 'com.brucetoo.pickview:library:1.2.2' 
     compile 'gun0912.ted:tedpermission:1.0.0' 
     compile 'com.squareup.okio:okio:1.11.0' 
     compile 'com.squareup.okhttp3:okhttp:3.4.1' 
     compile 'com.squareup.picasso:picasso:2.5.2' 
     compile 'com.basgeekball:awesome-validation:1.3' 
     compile 'com.google.code.gson:gson:2.4' 
     compile 'com.facebook.android:facebook-android-sdk:[4,5)' 
     compile 'com.github.aakira:expandable-layout:[email protected]' 
     compile 'fr.xebia.android.freezer:freezer:2.0.3' 
     provided 'fr.xebia.android.freezer:freezer-annotations:2.0.3' 
     apt 'fr.xebia.android.freezer:freezer-compiler:2.0.3' 
     compile "me.henrytao:smooth-app-bar-layout:24.2.1.0" 
     compile ("org.igniterealtime.smack:smack-android-extensions:4.1.8") { 
      exclude group: 'xpp3', module: 'xpp3' 
     } 
     compile ("org.igniterealtime.smack:smack-tcp:4.1.8"){ 
      exclude group: 'xpp3', module: 'xpp3' 
     } 
     compile ("org.igniterealtime.smack:smack-experimental:4.1.8"){ 
      exclude group: 'xpp3', module: 'xpp3' 
     } 
    } 
} 

auch, mein libs Ordner leer ist. Ich weiß nicht jar-Dateien

Link zu Smack-Wiki https://github.com/igniterealtime/Smack/wiki/Smack-4.1-Readme-and-Upgrade-Guide#using-eclipses-android-development-tools-adt-ant-based-build

Bitte benutzen, Hilfe, ich verlieren zwei Tage auf Festsetzung es

+0

Funktioniert es, wenn ProGuard deaktiviert ist? – Flow

+0

@Flow-Programm ist deaktiviert. Zur Zeit muss ich es nicht –

+0

versuchen, diese Abhängigkeit der Kompilierung hinzuzufügen ‚org.igniterealtime.smack: Klatschenkleks android: 4.1.8‘ –

Antwort

1

Ich war auch das gleiche Problem gegenüber. Versuchen, die folgende Abhängigkeit:

compile 'com.android.support:multidex:1.0.1'

und in Ihrer Anwendungsklasse dieses Add,

@Override 
    protected void attachBaseContext(Context base) 
    { 
      super.attachBaseContext(base); 
      MultiDex.install(BaseApplication.this); 
    } 
+1

@BhargavRao ich meine Antwort bearbeitet haben. –

+0

Funktioniert wie ein Charme – odemolliens

Verwandte Themen