失败是因为:de.measite.minidns.hla.ResolutionUnsuccessfulException:要求xxxx。在AAAA中产生了错误响应NX_DOMAIN

时间:2017-04-01 17:43:20

标签: android xmpp smack

我将smack升级到4.2.0后,我遇到了连接问题。

The following addresses failed: 'xxxx:5222' failed because: 

de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for xxxx.    IN  A yielded an error response NX_DOMAIN, '52.90.233.38:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for xxxx. IN  AAAA yielded an error response NX_DOMAIN

在连接配置构建器中设置主机时会发生此问题。

示例:

.setHost(ServiceConstants.CHAT_SERVER)

请参阅https://github.com/igniterealtime/Smack/wiki/Smack-4.2-Readme-and-Upgrade-Guide

这是我的最终配置,它在Davood Falahati帮助后起作用了!

InetAddress inetAddress = InetAddress.getByName(ServiceConstants.CHAT_SERVER);
            XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder()
                    .setXmppDomain(JidCreate.from(ServiceConstants.CHAT_SERVER).asDomainBareJid())
                    .setPort(5222)
                    .setHostAddress(inetAddress)
                    .setDebuggerEnabled(true)
                    .setSendPresence(true)

1 个答案:

答案 0 :(得分:11)

当在本地DNS中未配置xmpp服务器时,此问题主要发生在本地网络中。要解决此问题,请明确地解决xmpp服务器并使用

setHostAddress(InetAddress address)

请参阅我的回答here