在我的 Android/Cordova 应用程序中使用 Smack 遇到此错误,我找不到解决方法。
我在我的 gradle.build 中得到了这个,但是没有它,项目就无法运行: 配置{ all*.exclude 组:'xpp3',模块:'xpp3' 调试 发布 }
这是堆栈跟踪:
E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-4
java.lang.ExceptionInInitializerError
at org.jivesoftware.smack.Smack.getVersion(Smack.java:36)
at org.jivesoftware.smack.Smack.ensureInitialized(Smack.java:50)
at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:115)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration.builder(XMPPTCPConnectionConfiguration.java:64)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController.openConnection(XmppConnectionController.kt:134)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController.access$openConnection(XmppConnectionController.kt:24)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController$connect$2$1.invokeSuspend(XmppConnectionController.kt:93)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.IllegalStateException: Could not parse Smack configuration file
at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:106)
at org.jivesoftware.smack.Smack.getVersion(Smack.java:36)
at org.jivesoftware.smack.Smack.ensureInitialized(Smack.java:50)
at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:115)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration.builder(XMPPTCPConnectionConfiguration.java:64)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController.openConnection(XmppConnectionController.kt:134)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController.access$openConnection(XmppConnectionController.kt:24)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController$connect$2$1.invokeSuspend(XmppConnectionController.kt:93)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.IllegalStateException: No XmlPullParserFactory registered with Service Provider Interface (SPI). Is smack-xmlparser-xpp3 or smack-xmlparser-stax in classpath?
at org.jivesoftware.smack.xml.SmackXmlParser.getXmlPullParserFactory(SmackXmlParser.java:41)
at org.jivesoftware.smack.xml.SmackXmlParser.newXmlParser(SmackXmlParser.java:65)
at org.jivesoftware.smack.util.PacketParserUtils.getParserFor(PacketParserUtils.java:80)
at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:159)
at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:154)
at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:103)
at org.jivesoftware.smack.Smack.getVersion(Smack.java:36)
at org.jivesoftware.smack.Smack.ensureInitialized(Smack.java:50)
at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:115)
at org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration.builder(XMPPTCPConnectionConfiguration.java:64)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController.openConnection(XmppConnectionController.kt:134)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController.access$openConnection(XmppConnectionController.kt:24)
at com.iadvize.conversation.sdk.controller.conversation.xmpp.XmppConnectionController$connect$2$1.invokeSuspend(XmppConnectionController.kt:93)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)