2 qq 28659903 qq_28659903 于 2015.06.13 17:54 提问

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

5个回答

devmiao
devmiao   Ds   Rxr 2015.06.13 18:36

检查下防火墙端口ip等设置。

LogicTeamLeader
LogicTeamLeader   2015.06.13 22:06

输出的信息是什么?

qq_28659903
qq_28659903 不好意思 第一次用这玩意 不太习惯 …
2 年多之前 回复
qq_28659903
qq_28659903 输出log:
2 年多之前 回复
qq_28659903
qq_28659903 输出log:
2 年多之前 回复
qq_28659903
qq_28659903 输出log:
2 年多之前 回复
qq_28659903
qq_28659903 输出log:
2 年多之前 回复
qq_28659903
qq_28659903 输出log:
2 年多之前 回复
qq_28659903
qq_28659903 输出log:
2 年多之前 回复
qq_28659903
qq_28659903 没有错误信息 就是登录不上 走了connection.conn();之后就不往下执行了
2 年多之前 回复
u011133213
u011133213   2015.06.14 10:14

兄弟,你这信息量也忒不明确了吧。返回错误信息是什么输出?

qq_28659903
qq_28659903 没有错误信息 就是不执行 connection.login(account, pwd);这一句
2 年多之前 回复
qq_28659903
qq_28659903 没有错误信息
2 年多之前 回复
u013947649
u013947649   2015.06.14 15:43
u013947649
u013947649   2015.06.14 15:43
Csdn user default icon
上传中...
上传图片
插入图片