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.
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.