NoClassDefFoundError: org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration only API 19
NoClassDefFoundError: org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration only API 19
一周前,我开始使用 Smack API(4.1.8 版本)为我的应用程序实施聊天系统。它也适用于 Lolipop 设备和 Marshmallow。但是在 Kitkat( API 19) 我得到异常 NoClassDefFoundError
LogCat:
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.access0(ChatXMPPService.java:36)
at mobi.networking.ChatXMPPService.run(ChatXMPPService.java:112)
at java.lang.Thread.run(Thread.java:841)
那么第76行(第一行)是什么:
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);
我的构建-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:1.6.0@aar'
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'
}
}
}
另外,我的 libs 文件夹是空的。我不使用 jar 文件
Link 到 Smack-Wiki https://github.com/igniterealtime/Smack/wiki/Smack-4.1-Readme-and-Upgrade-Guide#using-eclipses-android-development-tools-adt-ant-based-build
拜托,帮忙,我花了两天时间修好它
我也遇到了同样的问题。
尝试添加以下依赖项:
compile 'com.android.support:multidex:1.0.1'
并在您的应用程序中 class 添加此内容,
@Override
protected void attachBaseContext(Context base)
{
super.attachBaseContext(base);
MultiDex.install(BaseApplication.this);
}
一周前,我开始使用 Smack API(4.1.8 版本)为我的应用程序实施聊天系统。它也适用于 Lolipop 设备和 Marshmallow。但是在 Kitkat( API 19) 我得到异常 NoClassDefFoundError LogCat:
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.access0(ChatXMPPService.java:36)
at mobi.networking.ChatXMPPService.run(ChatXMPPService.java:112)
at java.lang.Thread.run(Thread.java:841)
那么第76行(第一行)是什么:
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);
我的构建-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:1.6.0@aar'
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'
}
}
}
另外,我的 libs 文件夹是空的。我不使用 jar 文件
Link 到 Smack-Wiki https://github.com/igniterealtime/Smack/wiki/Smack-4.1-Readme-and-Upgrade-Guide#using-eclipses-android-development-tools-adt-ant-based-build
拜托,帮忙,我花了两天时间修好它
我也遇到了同样的问题。 尝试添加以下依赖项:
compile 'com.android.support:multidex:1.0.1'
并在您的应用程序中 class 添加此内容,
@Override
protected void attachBaseContext(Context base)
{
super.attachBaseContext(base);
MultiDex.install(BaseApplication.this);
}