问题描述
- Android中使用XMPP实现登录都可以连接上为什么登录不了
-
//创建连接
public void conn() {
ConnectionConfiguration config = new ConnectionConfiguration("192.68.12.8", 5222);
XMPPConnection connection = new XMPPConnection(config);
try {
connection.connect();
if(connection !=null){
connection.login(account, pwd);
startActivity(new Intent(LoginActivity.this,MainActivity.class));
}else{
Toast.makeText(LoginActivity.this, "Null null", Toast.LENGTH_SHORT).show();
}
Toast.makeText(LoginActivity.this, "Login success~", Toast.LENGTH_SHORT).show();
} catch (XMPPException e) {
e.printStackTrace();
}
}
}输出log: 06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ No response from the server.:
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at org.jivesoftware.smack.i.a(Unknown Source)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at org.jivesoftware.smack.XMPPConnection.login(Unknown Source)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at org.jivesoftware.smack.Connection.login(Unknown Source)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at com.example.key.androiddemo.LoginActivity.conn(LoginActivity.java:104)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at com.example.key.androiddemo.LoginActivity.onLoginClick(LoginActivity.java:64)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:511)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at android.view.View$1.onClick(View.java:3586)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at android.view.View.performClick(View.java:4084)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at android.view.View$PerformClick.run(View.java:16966)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:615)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:92)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at android.os.Looper.loop(Looper.java:137)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:4745)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:511)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
06-15 02:04:59.952 1212-1212/com.example.key.androiddemo I/Choreographer﹕ Skipped 315 frames! The application may be doing too much work on its main thread.
06-15 02:05:00.252 1212-1503/com.example.key.androiddemo W/System.err﹕ stream:error (host-unknown)
06-15 02:05:00.252 1212-1503/com.example.key.androiddemo W/System.err﹕ at org.jivesoftware.smack.j.a(Unknown Source)
06-15 02:05:00.252 1212-1503/com.example.key.androiddemo W/System.err﹕ at org.jivesoftware.smack.k.run(Unknown Source)
06-15 02:17:42.108 1212-1214/com.example.key.androiddemo D/dalvikvm﹕ GC_CONCURRENT freed 385K, 5% free 11001K/11527K, paused 1ms+2ms, total 11ms
解决方案
检查下防火墙端口ip等设置。
解决方案二:
输出的信息是什么?
解决方案三:
兄弟,你这信息量也忒不明确了吧。返回错误信息是什么输出?
解决方案四:
7日语二级证1996年日语能力认定证书2001年日语一级证书
解决方案五:
7日语二级证1996年日语能力认定证书2001年日语一级证书