今日、ローカルの xmpp サーバーに接続するために Android クライアントを実装します。コードが次のコードを実行すると、Android アプリが中止されます。助けてください:
public boolean login(String a, String p){
ConnectionConfiguration config = new ConnectionConfiguration("192.168.1.119");
config.setSASLAuthenticationEnabled(false);
config.setDebuggerEnabled(false);
XMPPConnection connection = new XMPPConnection(config);
try{
System.out.println("hehe");
connection.connect();
connection.login(a, p);
//Presence presence = new Presence(Presence.Type.available);
//presence.setStatus("hehe");
//connection.sendPacket(presence);
return true;
}catch(XMPPException e){
e.printStackTrace();
}
return false;
}
次のエラーが発生しました。
08-09 23:30:19.091: E/AndroidRuntime(1860): FATAL EXCEPTION: main
08-09 23:30:19.091: E/AndroidRuntime(1860): java.lang.IllegalStateException: No DNS resolver active.
08-09 23:30:19.091: E/AndroidRuntime(1860): at org.jivesoftware.smack.util.DNSUtil.resolveDomain(DNSUtil.java:121)
08-09 23:30:19.091: E/AndroidRuntime(1860): at org.jivesoftware.smack.util.DNSUtil.resolveXMPPDomain(DNSUtil.java:85)
08-09 23:30:19.091: E/AndroidRuntime(1860): at org.jivesoftware.smack.ConnectionConfiguration.<init>(ConnectionConfiguration.java:107)
08-09 23:30:19.091: E/AndroidRuntime(1860): at com.example.chatrom.ClientConServer.login(ClientConServer.java:16)
08-09 23:30:19.091: E/AndroidRuntime(1860): at com.example.chatrom.LogIn$1.onClick(LogIn.java:32)
08-09 23:30:19.091: E/AndroidRuntime(1860): at android.view.View.performClick(View.java:4240)
08-09 23:30:19.091: E/AndroidRuntime(1860): at android.view.View$PerformClick.run(View.java:17721)
08-09 23:30:19.091: E/AndroidRuntime(1860): at android.os.Handler.handleCallback(Handler.java:730)
08-09 23:30:19.091: E/AndroidRuntime(1860): at android.os.Handler.dispatchMessage(Handler.java:92)
08-09 23:30:19.091: E/AndroidRuntime(1860): at android.os.Looper.loop(Looper.java:137)
08-09 23:30:19.091: E/AndroidRuntime(1860): at android.app.ActivityThread.main(ActivityThread.java:5103)
08-09 23:30:19.091: E/AndroidRuntime(1860): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 23:30:19.091: E/AndroidRuntime(1860): at java.lang.reflect.Method.invoke(Method.java:525)
08-09 23:30:19.091: E/AndroidRuntime(1860): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-09 23:30:19.091: E/AndroidRuntime(1860): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-09 23:30:19.091: E/AndroidRuntime(1860): at dalvik.system.NativeStart.main(Native Method)