Smack Version: 4.4.0
Stacktrace: The exception appear when I initialize an XMPPTCPConnection on Android with api level 19. I don’t have any problem when I run my app in upper versions
E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
Process: com.planout.app.debug, PID: 7026
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.AbstractXMPPConnection.<clinit>(AbstractXMPPConnection.java:174)
at es.planout.android.data.network.messaging.BaseSmackService.<init>(BaseSmackService.kt:48)
at es.planout.android.data.network.messaging.SmackService.<init>(SmackService.kt:34)
at es.planout.android.data.di.NetworkModuleKt$networkModule$1$1.invoke(NetworkModule.kt:13)
at es.planout.android.data.di.NetworkModuleKt$networkModule$1$1.invoke(NetworkModule.kt)
at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:50)
at org.koin.core.instance.SingleInstanceFactory.create(SingleInstanceFactory.kt:40)
at org.koin.core.instance.SingleInstanceFactory.get(SingleInstanceFactory.kt:48)
at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:87)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:214)
at org.koin.core.scope.Scope.get(Scope.kt:181)
at es.planout.android.app.PlanOutApp$$special$$inlined$inject$1.invoke(ComponentCallbackExt.kt:51)
at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
at es.planout.android.app.PlanOutApp.getSmackService(PlanOutApp.kt)
at es.planout.android.app.PlanOutApp.loginService(PlanOutApp.kt:119)
at es.planout.android.app.PlanOutApp$onAppForegrounded$1.invokeSuspend(PlanOutApp.kt:159)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
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.AbstractXMPPConnection.<clinit>(AbstractXMPPConnection.java:174)
at es.planout.android.data.network.messaging.BaseSmackService.<init>(BaseSmackService.kt:48)
at es.planout.android.data.network.messaging.SmackService.<init>(SmackService.kt:34)
at es.planout.android.data.di.NetworkModuleKt$networkModule$1$1.invoke(NetworkModule.kt:13)
at es.planout.android.data.di.NetworkModuleKt$networkModule$1$1.invoke(NetworkModule.kt)
at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:50)
at org.koin.core.instance.SingleInstanceFactory.create(SingleInstanceFactory.kt:40)
at org.koin.core.instance.SingleInstanceFactory.get(SingleInstanceFactory.kt:48)
at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:87)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:214)
at org.koin.core.scope.Scope.get(Scope.kt:181)
at es.planout.android.app.PlanOutApp$$special$$inlined$inject$1.invoke(ComponentCallbackExt.kt:51)
at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
at es.planout.android.app.PlanOutApp.getSmackService(PlanOutApp.kt)
at es.planout.android.app.PlanOutApp.loginService(PlanOutApp.kt:119)
at es.planout.android.app.PlanOutApp$onAppForegrounded$1.invokeSuspend(PlanOutApp.kt:159)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
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:34)
at org.jivesoftware.smack.xml.SmackXmlParser.newXmlParser(SmackXmlParser.java:54)
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.AbstractXMPPConnection.<clinit>(AbstractXMPPConnection.java:174)
at es.planout.android.data.network.messaging.BaseSmackService.<init>(BaseSmackService.kt:48)
at es.planout.android.data.network.messaging.SmackService.<init>(SmackService.kt:34)
at es.planout.android.data.di.NetworkModuleKt$networkModule$1$1.invoke(NetworkModule.kt:13)
at es.planout.android.data.di.NetworkModuleKt$networkModule$1$1.invoke(NetworkModule.kt)
at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:50)
at org.koin.core.instance.SingleInstanceFactory.create(SingleInstanceFactory.kt:40)
at org.koin.core.instance.SingleInstanceFactory.get(SingleInstanceFactory.kt:48)
at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:87)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:214)
at org.koin.core.scope.Scope.get(Scope.kt:181)
at es.planout.android.app.PlanOutApp$$special$$inlined$inject$1.invoke(ComponentCallbackExt.kt:51)
at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
at es.planout.android.app.PlanOutApp.getSmackService(PlanOutApp.kt)
at es.planout.android.app.PlanOutApp.loginService(PlanOutApp.kt:119)
at es.planout.android.app.PlanOutApp$onAppForegrounded$1.invokeSuspend(PlanOutApp.kt:159)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I had similar problem in 4.3.5 but I solved with some proguard rules.
-keep class org.jivesoftware.smack.initializer.SmackInitializer
-keep class org.jivesoftware.smack.initializer.VmArgInitializer
-keep class org.jivesoftware.** { *;}
-keepclassmembers enum * {*;}
Thank you in advance