我不斷收到下面的錯誤信息,我找不出原因。任何幫助,將不勝感激:Android SmackInitialization:org.xmlpull.v1.XmlPullParserFactory.newInstance錯誤
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:38)
at com.parental.control.XmppClient.connect(XmppClient.java:32)
at com.parental.control.XmppClient.main(XmppClient.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.IllegalStateException: java.lang.RuntimeException: Stub!
at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:119)
... 9 more
Caused by: java.lang.RuntimeException: Stub!
at org.xmlpull.v1.XmlPullParserFactory.newInstance(XmlPullParserFactory.java:16)
at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:153)
at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:148)
at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:116)
... 9 more
只需運行下面的代碼:
private void connect() throws InterruptedException, IOException, XMPPException, SmackException {
XMPPTCPConnectionConfiguration conf = XMPPTCPConnectionConfiguration.builder().setServiceName(hostName).setHost(<openFireServerHost).setPort(5222).setUsernameAndPassword(userName, password).setCompressionEnabled(false).build();
XMPPTCPConnection connection = new XMPPTCPConnection(conf);
}