Unable to instantiate XmlPullParser

using just the dependencies of

  • smack-tcp:4.5.0-alpha1
  • smack-im:4.5.0-alpha1
  • smack-extensions:4.5.0-alpha1
  • smak-java8:4.4.0

in a maven environment, I can connect to my openfire server without issue.

However, when I use the same code in an android app built with gradle and using the same dependencies, I get the following error:
org.jivesoftware.smack.xml.XmlPullParserFactory: Provider org.jivesoftware.smack.xml.stax.StaxXmlPullParserFactory could not be instantiated.

Please help.

It seems that you are missing dependencies. At least smack-xmlparser-xpp3. How did you add Smack to your project? As plain jar files, or via Maven POM dependency declarations? You always should use the latter to avoid exactly this situation, where transitive dependencies are missing.

Adding this dependency gives a build error due to duplicate classes. I can confirm that the interface XmlPullParserFactory is in the project files.

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.