Android Oreo ReconnectionManager crash

I’ve just updated my phone to the latest Android 8 Oreo, now I am getting application crashes:

09-12 10:01:26.582 E/AndroidRuntime: FATAL EXCEPTION: Smack Reconnection Manager (1)

Process: com.accelior.vega.debug, PID: 29209

java.lang.NullPointerException: Attempt to get length of null array
at de.measite.minidns.DNSClient.query(DNSClient.java:116)
at de.measite.minidns.iterative.ReliableDNSClient.query(ReliableDNSClient.java:96)
at de.measite.minidns.AbstractDNSClient.query(AbstractDNSClient.java:145)
at de.measite.minidns.hla.ResolverApi.resolve(ResolverApi.java:44)
at de.measite.minidns.hla.ResolverApi.resolve(ResolverApi.java:40)
at de.measite.minidns.hla.ResolverApi.resolve(ResolverApi.java:34)
at org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver.lookupHostAddress0(Mini DnsResolver.java:112)
at org.jivesoftware.smack.util.dns.DNSResolver.lookupHostAddress(DNSResolver.java: 55)
at org.jivesoftware.smack.AbstractXMPPConnection.populateHostAddresses(AbstractXMP PConnection.java:620)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:556)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:888)
at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.ja va:377)
at org.jivesoftware.smack.ReconnectionManager$2.run(ReconnectionManager.java:244)
at java.lang.Thread.run(Thread.java:764)

As a possible solution to this, in the ReconnectionManager.reconnectionRunnable, instead of catching only a specific set of exceptions, catch all of them:

catch (Exception e) {
// Fires the failed reconnection notification
for (ConnectionListener listener : connection.connectionListeners) {
listener.reconnectionFailed(e);
}
}

Smack lib both 4.2.0 and 4.2.1

Thanks for reporting.

Catch all is usually a very bad idea. I’d first try to understand what’s happening here.

BTW: That’s most likely caused by API changes for apps targeting Android 8.0 and using net.dns. See Android 8.0 Behavior Changes | Android Developers

Likely in combination with Fix NPE in DNSClient · rtreffer/minidns@6bbf172 · GitHub not being released as MiniDNS 0.2.3

I am having yet another issue with MiniDNS library: IllegalArgumentException: “Invalid input to toASCII: .” at DNSName(".", false) · Issue #70 · rtreffer/minidns · GitHub

And seems that 0.2.3 library which is used currently is very buggy and eventually, has been revoked from the repository. Do you have any ETA for the next release?

Yes, I understand, that catching all is not good idea, however it is right now is the only workaround to make the application work at least somehow.

This and you initial bug should be fixed in MiniDNS 0.2.4.

Забыл прописать INTERNET permission.