我关注此Integrate Facebook chat in android with Asmack API,请参阅接受的答案* Hitesh Patel *。
我已按照步骤操作。最后,应用程序应该显示我的好友Facebook列表(正如Hitesh patel所说)。但我的应用程序崩溃了。
这是 Hitesh Patel
的方法public void connectToFb() throws XMPPException {
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222);
config.setSASLAuthenticationEnabled(true);
config.setSecurityMode(SecurityMode.required);
config.setRosterLoadedAtLogin(true);
config.setTruststorePath("/system/etc/security/cacerts.bks");
config.setTruststorePassword("changeit");
config.setTruststoreType("bks");
config.setSendPresence(false);
try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, MemorizingTrustManager.getInstanceList(this), new java.security.SecureRandom());
config.setCustomSSLContext(sc);
} catch (GeneralSecurityException e) {
Log.w("TAG", "Unable to use MemorizingTrustManager", e);
}
XMPPConnection xmpp = new XMPPConnection(config);
try {
xmpp.connect();
xmpp.login("myfbUsername", "myPassword"); // Here you have to used only facebookusername from facebookusername@chat.facebook.com
Roster roster = xmpp.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
System.out.println("Connected!");
System.out.println("\n\n" + entries.size() + " buddy(ies):");
// shows first time onliners---->
String temp[] = new String[50];
int i = 0;
for (RosterEntry entry : entries) {
String user = entry.getUser();
Log.i("TAG", user);
}
} catch (XMPPException e) {
xmpp.disconnect();
e.printStackTrace();
}
}
我打电话给这个就像这样
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
connectToFb();
} catch (XMPPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("Exception", "Occured");
}
}
但应用程序崩溃,这是我的堆栈跟踪。请看看它
06-18 13:24:03.473: I/MemorizingTrustManager(539): getAppKeyStore(/data/data/com.example.facebookchatdemo/app_KeyStore/KeyStore.bks) - file does not exist
06-18 13:24:04.714: D/dalvikvm(539): GC_CONCURRENT freed 1206K, 57% free 2925K/6727K, external 1625K/2137K, paused 6ms+5ms
06-18 13:24:05.412: D/dalvikvm(539): GC_FOR_MALLOC freed 207K, 56% free 2991K/6727K, external 1625K/2137K, paused 45ms
06-18 13:24:05.412: I/dalvikvm-heap(539): Grow heap (frag case) to 7.083MB for 16400-byte allocation
06-18 13:24:05.532: D/dalvikvm(539): GC_FOR_MALLOC freed 0K, 56% free 3007K/6791K, external 1625K/2137K, paused 46ms
06-18 13:24:06.004: D/dalvikvm(539): GC_FOR_MALLOC freed 12K, 55% free 3060K/6791K, external 1625K/2137K, paused 85ms
06-18 13:24:06.004: I/dalvikvm-heap(539): Grow heap (frag case) to 7.151MB for 16400-byte allocation
06-18 13:24:06.093: D/dalvikvm(539): GC_FOR_MALLOC freed 0K, 56% free 3076K/6855K, external 1625K/2137K, paused 73ms
06-18 13:24:06.503: E/dalvikvm(539): Could not find class 'java.beans.PropertyDescriptor', referenced from method org.jivesoftware.smack.util.PacketParserUtils.parseWithIntrospection
06-18 13:24:06.524: W/dalvikvm(539): VFY: unable to resolve new-instance 603 (Ljava/beans/PropertyDescriptor;) in Lorg/jivesoftware/smack/util/PacketParserUtils;
06-18 13:24:06.524: D/dalvikvm(539): VFY: replacing opcode 0x22 at 0x0016
06-18 13:24:06.524: D/dalvikvm(539): VFY: dead code 0x0018-0030 in Lorg/jivesoftware/smack/util/PacketParserUtils;.parseWithIntrospection (Ljava/lang/String;Ljava/lang/Class;Lorg/xmlpull/v1/XmlPullParser;)Ljava/lang/Object;
06-18 13:24:07.272: D/MemorizingTrustManager(539): checkCertTrusted([Ljava.security.cert.X509Certificate;@4055f908, RSA, true)
06-18 13:24:07.272: D/MemorizingTrustManager(539): checkCertTrusted: trying appTrustManager
06-18 13:24:07.272: W/System.err(539): java.security.cert.CertificateException: java.security.InvalidAlgorithmParameterException: trustAnchors.isEmpty()
06-18 13:24:07.272: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:144)
06-18 13:24:07.284: W/System.err(539): at com.example.facebookchatdemo.MemorizingTrustManager.checkCertTrusted(MemorizingTrustManager.java:288)
06-18 13:24:07.284: W/System.err(539): at com.example.facebookchatdemo.MemorizingTrustManager.checkServerTrusted(MemorizingTrustManager.java:325)
06-18 13:24:07.284: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:664)
06-18 13:24:07.284: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
06-18 13:24:07.284: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:474)
06-18 13:24:07.284: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.<init>(OpenSSLSocketImpl.java:750)
06-18 13:24:07.284: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:692)
06-18 13:24:07.284: W/System.err(539): at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:714)
06-18 13:24:07.293: W/System.err(539): at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:873)
06-18 13:24:07.293: W/System.err(539): at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)
06-18 13:24:07.293: W/System.err(539): at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
06-18 13:24:07.293: W/System.err(539): at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
06-18 13:24:07.293: W/System.err(539): Caused by: java.security.InvalidAlgorithmParameterException: trustAnchors.isEmpty()
06-18 13:24:07.323: W/System.err(539): at java.security.cert.PKIXParameters.checkTrustAnchors(PKIXParameters.java:607)
06-18 13:24:07.323: W/System.err(539): at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:84)
06-18 13:24:07.323: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.<init>(TrustManagerImpl.java:75)
06-18 13:24:07.323: W/System.err(539): at org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl.engineGetTrustManagers(TrustManagerFactoryImpl.java:132)
06-18 13:24:07.323: W/System.err(539): at javax.net.ssl.TrustManagerFactory.getTrustManagers(TrustManagerFactory.java:225)
06-18 13:24:07.323: W/System.err(539): at com.example.facebookchatdemo.MemorizingTrustManager.getTrustManager(MemorizingTrustManager.java:203)
06-18 13:24:07.323: W/System.err(539): at com.example.facebookchatdemo.MemorizingTrustManager.<init>(MemorizingTrustManager.java:126)
06-18 13:24:07.323: W/System.err(539): at com.example.facebookchatdemo.MemorizingTrustManager.getInstanceList(MemorizingTrustManager.java:147)
06-18 13:24:07.323: W/System.err(539): at com.example.facebookchatdemo.MainActivity.connectToFb(MainActivity.java:88)
06-18 13:24:07.333: W/System.err(539): at com.example.facebookchatdemo.MainActivity.onCreate(MainActivity.java:35)
06-18 13:24:07.333: W/System.err(539): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-18 13:24:07.333: W/System.err(539): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-18 13:24:07.333: W/System.err(539): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-18 13:24:07.333: W/System.err(539): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-18 13:24:07.333: W/System.err(539): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-18 13:24:07.333: W/System.err(539): at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 13:24:07.342: W/System.err(539): at android.os.Looper.loop(Looper.java:123)
06-18 13:24:07.342: W/System.err(539): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-18 13:24:07.342: W/System.err(539): at java.lang.reflect.Method.invokeNative(Native Method)
06-18 13:24:07.342: W/System.err(539): at java.lang.reflect.Method.invoke(Method.java:507)
06-18 13:24:07.342: W/System.err(539): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-18 13:24:07.342: W/System.err(539): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-18 13:24:07.342: W/System.err(539): at dalvik.system.NativeStart.main(Native Method)
06-18 13:24:07.352: D/MemorizingTrustManager(539): checkCertTrusted: trying defaultTrustManager
06-18 13:24:07.894: D/dalvikvm(539): GC_CONCURRENT freed 588K, 54% free 3220K/6855K, external 1625K/2137K, paused 5ms+5ms
06-18 13:24:08.432: D/dalvikvm(539): GC_CONCURRENT freed 708K, 53% free 3233K/6855K, external 1625K/2137K, paused 5ms+5ms
06-18 13:24:08.882: D/dalvikvm(539): GC_FOR_MALLOC freed 635K, 53% free 3250K/6855K, external 1625K/2137K, paused 53ms
06-18 13:24:09.192: D/dalvikvm(539): GC_FOR_MALLOC freed 528K, 53% free 3268K/6855K, external 1625K/2137K, paused 51ms
06-18 13:24:09.503: D/dalvikvm(539): GC_FOR_MALLOC freed 518K, 53% free 3286K/6855K, external 1625K/2137K, paused 51ms
06-18 13:24:09.802: D/dalvikvm(539): GC_FOR_MALLOC freed 330K, 53% free 3276K/6855K, external 1625K/2137K, paused 62ms
06-18 13:24:09.802: I/dalvikvm-heap(539): Grow heap (frag case) to 7.355MB for 8208-byte allocation
06-18 13:24:09.923: D/dalvikvm(539): GC_FOR_MALLOC freed <1K, 53% free 3283K/6919K, external 1625K/2137K, paused 48ms
06-18 13:24:10.062: D/dalvikvm(539): GC_FOR_MALLOC freed 25K, 53% free 3316K/6919K, external 1625K/2137K, paused 60ms
06-18 13:24:10.414: I/dalvikvm(539): Could not find method javax.security.sasl.SaslClient.hasInitialResponse, referenced from method org.jivesoftware.smack.sasl.SASLMechanism.authenticate
06-18 13:24:10.422: W/dalvikvm(539): VFY: unable to resolve interface method 5004: Ljavax/security/sasl/SaslClient;.hasInitialResponse ()Z
06-18 13:24:10.422: D/dalvikvm(539): VFY: replacing opcode 0x72 at 0x0003
06-18 13:24:10.422: W/dalvikvm(539): VFY: unable to resolve exception class 820 (Ljavax/security/sasl/SaslException;)
06-18 13:24:10.422: W/dalvikvm(539): VFY: unable to find exception handler at addr 0x28
06-18 13:24:10.422: W/dalvikvm(539): VFY: rejected Lorg/jivesoftware/smack/sasl/SASLMechanism;.authenticate ()V
06-18 13:24:10.422: W/dalvikvm(539): VFY: rejecting opcode 0x0d at 0x0028
06-18 13:24:10.422: W/dalvikvm(539): VFY: rejected Lorg/jivesoftware/smack/sasl/SASLMechanism;.authenticate ()V
06-18 13:24:10.422: W/dalvikvm(539): Verifier rejected class Lorg/jivesoftware/smack/sasl/SASLMechanism;
06-18 13:24:10.453: D/AndroidRuntime(539): Shutting down VM
06-18 13:24:10.453: W/dalvikvm(539): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-18 13:24:10.472: E/AndroidRuntime(539): FATAL EXCEPTION: main
06-18 13:24:10.472: E/AndroidRuntime(539): java.lang.VerifyError: org.jivesoftware.smack.sasl.SASLMechanism
06-18 13:24:10.472: E/AndroidRuntime(539): at java.lang.Class.getDeclaredConstructors(Native Method)
06-18 13:24:10.472: E/AndroidRuntime(539): at java.lang.Class.getConstructor(Class.java:472)
06-18 13:24:10.472: E/AndroidRuntime(539): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:314)
06-18 13:24:10.472: E/AndroidRuntime(539): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:221)
06-18 13:24:10.472: E/AndroidRuntime(539): at org.jivesoftware.smack.Connection.login(Connection.java:366)
06-18 13:24:10.472: E/AndroidRuntime(539): at com.example.facebookchatdemo.MainActivity.connectToFb(MainActivity.java:97)
06-18 13:24:10.472: E/AndroidRuntime(539): at com.example.facebookchatdemo.MainActivity.onCreate(MainActivity.java:35)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.os.Looper.loop(Looper.java:123)
06-18 13:24:10.472: E/AndroidRuntime(539): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-18 13:24:10.472: E/AndroidRuntime(539): at java.lang.reflect.Method.invokeNative(Native Method)
06-18 13:24:10.472: E/AndroidRuntime(539): at java.lang.reflect.Method.invoke(Method.java:507)
06-18 13:24:10.472: E/AndroidRuntime(539): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-18 13:24:10.472: E/AndroidRuntime(539): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-18 13:24:10.472: E/AndroidRuntime(539): at dalvik.system.NativeStart.main(Native Method)
06-18 13:25:10.722: W/System.err(539): java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen ...</mechanisms></stream:features>... @1:349
06-18 13:25:10.722: W/System.err(539): at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
06-18 13:25:10.722: W/System.err(539): at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
06-18 13:25:10.722: W/System.err(539): at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
06-18 13:25:10.722: W/System.err(539): at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
06-18 13:25:10.722: W/System.err(539): at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
06-18 13:25:10.722: W/System.err(539): at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
06-18 13:25:10.732: W/System.err(539): at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
06-18 13:29:10.659: I/Process(539): Sending signal. PID: 539 SIG: 9
06-18 13:32:10.354: I/MemorizingTrustManager(575): getAppKeyStore(/data/data/com.example.facebookchatdemo/app_KeyStore/KeyStore.bks) - file does not exist
06-18 13:32:11.502: D/dalvikvm(575): GC_CONCURRENT freed 1194K, 57% free 2937K/6727K, external 1625K/2137K, paused 4ms+5ms
06-18 13:32:12.132: D/dalvikvm(575): GC_FOR_MALLOC freed 226K, 56% free 3009K/6727K, external 1625K/2137K, paused 59ms
06-18 13:32:12.132: I/dalvikvm-heap(575): Grow heap (frag case) to 7.101MB for 16400-byte allocation
06-18 13:32:12.194: D/dalvikvm(575): GC_FOR_MALLOC freed 0K, 56% free 3025K/6791K, external 1625K/2137K, paused 50ms
06-18 13:32:12.814: E/dalvikvm(575): Could not find class 'java.beans.PropertyDescriptor', referenced from method org.jivesoftware.smack.util.PacketParserUtils.parseWithIntrospection
06-18 13:32:12.814: W/dalvikvm(575): VFY: unable to resolve new-instance 783 (Ljava/beans/PropertyDescriptor;) in Lorg/jivesoftware/smack/util/PacketParserUtils;
06-18 13:32:12.814: D/dalvikvm(575): VFY: replacing opcode 0x22 at 0x0016
06-18 13:32:12.814: D/dalvikvm(575): VFY: dead code 0x0018-0030 in Lorg/jivesoftware/smack/util/PacketParserUtils;.parseWithIntrospection (Ljava/lang/String;Ljava/lang/Class;Lorg/xmlpull/v1/XmlPullParser;)Ljava/lang/Object;
06-18 13:32:13.542: D/dalvikvm(575): GC_FOR_MALLOC freed 30K, 55% free 3119K/6791K, external 1625K/2137K, paused 41ms
06-18 13:32:13.542: I/dalvikvm-heap(575): Grow heap (frag case) to 7.208MB for 16400-byte allocation
06-18 13:32:13.663: D/dalvikvm(575): GC_FOR_MALLOC freed <1K, 55% free 3135K/6855K, external 1625K/2137K, paused 43ms
06-18 13:32:13.722: D/MemorizingTrustManager(575): checkCertTrusted([Ljava.security.cert.X509Certificate;@40614618, RSA, true)
06-18 13:32:13.722: D/MemorizingTrustManager(575): checkCertTrusted: trying appTrustManager
06-18 13:32:13.722: W/System.err(575): java.security.cert.CertificateException: java.security.InvalidAlgorithmParameterException: trustAnchors.isEmpty()
06-18 13:32:13.722: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:144)
06-18 13:32:13.722: W/System.err(575): at com.example.facebookchatdemo.MemorizingTrustManager.checkCertTrusted(MemorizingTrustManager.java:288)
06-18 13:32:13.722: W/System.err(575): at com.example.facebookchatdemo.MemorizingTrustManager.checkServerTrusted(MemorizingTrustManager.java:325)
06-18 13:32:13.722: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:664)
06-18 13:32:13.722: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
06-18 13:32:13.733: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:474)
06-18 13:32:13.733: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.<init>(OpenSSLSocketImpl.java:750)
06-18 13:32:13.733: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:692)
06-18 13:32:13.733: W/System.err(575): at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:714)
06-18 13:32:13.733: W/System.err(575): at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:873)
06-18 13:32:13.733: W/System.err(575): at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)
06-18 13:32:13.733: W/System.err(575): at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
06-18 13:32:13.733: W/System.err(575): at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
06-18 13:32:13.743: W/System.err(575): Caused by: java.security.InvalidAlgorithmParameterException: trustAnchors.isEmpty()
06-18 13:32:13.743: W/System.err(575): at java.security.cert.PKIXParameters.checkTrustAnchors(PKIXParameters.java:607)
06-18 13:32:13.743: W/System.err(575): at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:84)
06-18 13:32:13.743: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.<init>(TrustManagerImpl.java:75)
06-18 13:32:13.743: W/System.err(575): at org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl.engineGetTrustManagers(TrustManagerFactoryImpl.java:132)
06-18 13:32:13.743: W/System.err(575): at javax.net.ssl.TrustManagerFactory.getTrustManagers(TrustManagerFactory.java:225)
06-18 13:32:13.752: W/System.err(575): at com.example.facebookchatdemo.MemorizingTrustManager.getTrustManager(MemorizingTrustManager.java:203)
06-18 13:32:13.752: W/System.err(575): at com.example.facebookchatdemo.MemorizingTrustManager.<init>(MemorizingTrustManager.java:126)
06-18 13:32:13.752: W/System.err(575): at com.example.facebookchatdemo.MemorizingTrustManager.getInstanceList(MemorizingTrustManager.java:147)
06-18 13:32:13.752: W/System.err(575): at com.example.facebookchatdemo.MainActivity.connectToFb(MainActivity.java:81)
06-18 13:32:13.752: W/System.err(575): at com.example.facebookchatdemo.MainActivity.onCreate(MainActivity.java:28)
06-18 13:32:13.752: W/System.err(575): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-18 13:32:13.762: W/System.err(575): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-18 13:32:13.762: W/System.err(575): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-18 13:32:13.762: W/System.err(575): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-18 13:32:13.762: W/System.err(575): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-18 13:32:13.762: W/System.err(575): at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 13:32:13.762: W/System.err(575): at android.os.Looper.loop(Looper.java:123)
06-18 13:32:13.774: W/System.err(575): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-18 13:32:13.774: W/System.err(575): at java.lang.reflect.Method.invokeNative(Native Method)
06-18 13:32:13.774: W/System.err(575): at java.lang.reflect.Method.invoke(Method.java:507)
06-18 13:32:13.774: W/System.err(575): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-18 13:32:13.774: W/System.err(575): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-18 13:32:13.774: W/System.err(575): at dalvik.system.NativeStart.main(Native Method)
06-18 13:32:13.774: D/MemorizingTrustManager(575): checkCertTrusted: trying defaultTrustManager
06-18 13:32:14.393: D/dalvikvm(575): GC_CONCURRENT freed 647K, 53% free 3239K/6855K, external 1625K/2137K, paused 5ms+6ms
06-18 13:32:14.682: D/dalvikvm(575): GC_FOR_MALLOC freed 341K, 53% free 3249K/6855K, external 1625K/2137K, paused 50ms
06-18 13:32:14.743: D/dalvikvm(575): GC_FOR_MALLOC freed 25K, 53% free 3241K/6855K, external 1625K/2137K, paused 52ms
06-18 13:32:14.783: D/dalvikvm(575): GC_FOR_MALLOC freed <1K, 53% free 3256K/6855K, external 1625K/2137K, paused 48ms
06-18 13:32:14.783: I/dalvikvm-heap(575): Grow heap (frag case) to 7.344MB for 16400-byte allocation
06-18 13:32:14.912: D/dalvikvm(575): GC_FOR_MALLOC freed 0K, 53% free 3272K/6919K, external 1625K/2137K, paused 49ms
06-18 13:32:15.332: I/dalvikvm(575): Could not find method javax.security.sasl.SaslClient.hasInitialResponse, referenced from method org.jivesoftware.smack.sasl.SASLMechanism.authenticate
06-18 13:32:15.332: W/dalvikvm(575): VFY: unable to resolve interface method 6197: Ljavax/security/sasl/SaslClient;.hasInitialResponse ()Z
06-18 13:32:15.332: D/dalvikvm(575): VFY: replacing opcode 0x72 at 0x0003
06-18 13:32:15.332: W/dalvikvm(575): VFY: unable to resolve exception class 1025 (Ljavax/security/sasl/SaslException;)
06-18 13:32:15.332: W/dalvikvm(575): VFY: unable to find exception handler at addr 0x28
06-18 13:32:15.332: W/dalvikvm(575): VFY: rejected Lorg/jivesoftware/smack/sasl/SASLMechanism;.authenticate ()V
06-18 13:32:15.332: W/dalvikvm(575): VFY: rejecting opcode 0x0d at 0x0028
06-18 13:32:15.332: W/dalvikvm(575): VFY: rejected Lorg/jivesoftware/smack/sasl/SASLMechanism;.authenticate ()V
06-18 13:32:15.332: W/dalvikvm(575): Verifier rejected class Lorg/jivesoftware/smack/sasl/SASLMechanism;
06-18 13:32:15.343: D/AndroidRuntime(575): Shutting down VM
06-18 13:32:15.343: W/dalvikvm(575): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-18 13:32:15.363: E/AndroidRuntime(575): FATAL EXCEPTION: main
06-18 13:32:15.363: E/AndroidRuntime(575): java.lang.VerifyError: org.jivesoftware.smack.sasl.SASLMechanism
06-18 13:32:15.363: E/AndroidRuntime(575): at java.lang.Class.getDeclaredConstructors(Native Method)
06-18 13:32:15.363: E/AndroidRuntime(575): at java.lang.Class.getConstructor(Class.java:472)
06-18 13:32:15.363: E/AndroidRuntime(575): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:314)
06-18 13:32:15.363: E/AndroidRuntime(575): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:221)
06-18 13:32:15.363: E/AndroidRuntime(575): at org.jivesoftware.smack.Connection.login(Connection.java:366)
06-18 13:32:15.363: E/AndroidRuntime(575): at com.example.facebookchatdemo.MainActivity.connectToFb(MainActivity.java:90)
06-18 13:32:15.363: E/AndroidRuntime(575): at com.example.facebookchatdemo.MainActivity.onCreate(MainActivity.java:28)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.os.Looper.loop(Looper.java:123)
06-18 13:32:15.363: E/AndroidRuntime(575): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-18 13:32:15.363: E/AndroidRuntime(575): at java.lang.reflect.Method.invokeNative(Native Method)
06-18 13:32:15.363: E/AndroidRuntime(575): at java.lang.reflect.Method.invoke(Method.java:507)
06-18 13:32:15.363: E/AndroidRuntime(575): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-18 13:32:15.363: E/AndroidRuntime(575): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-18 13:32:15.363: E/AndroidRuntime(575): at dalvik.system.NativeStart.main(Native Method)
06-18 13:32:19.023: I/Process(575): Sending signal. PID: 575 SIG: 9
接下来我该怎么办?我被困了
我应该对这些进行任何更改吗?
config.setSASLAuthenticationEnabled(true);
config.setSecurityMode(SecurityMode.required);
config.setRosterLoadedAtLogin(true);
config.setTruststorePath("/system/etc/security/cacerts.bks");
config.setTruststorePassword("changeit");
config.setTruststoreType("bks");
config.setSendPresence(false);