2

我已经包含了 logcat 输出。请帮我解决这个问题。

08-09 11:06:32.762: WARN/NetworkManagementSocketTagger(883): setKernelCountSet(10012, 0) 失败,错误号 -2

08-09 11:06:32.856: WARN/System.err(1567): java.security.KeyStoreException: ava.security.NoSuchAlgorithmException: KeyStore jks implementation not found

08-09 11:06:32.856: WARN/System.err(1567): 在 java.security.KeyStore.getInstance(KeyStore.java:119)

08-09 11:06:32.856: WARN/System.err(1567): at org.jivesoftware.smack.ServerTrustManager.(ServerTrustManager.java:70)

08-09 11:06:32.856: WARN/System.err(1567): 在 org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:871)

08-09 11:06:32.856: WARN/System.err(1567): at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)

08-09 11:06:32.856: WARN/System.err(1567): at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

08-09 11:06:32.856: WARN/System.err(1567): at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)

08-09 11:06:32.856: WARN/System.err(1567): 由: java.security.NoSuchAlgorithmException: KeyStore jks implementation not found

08-09 11:06:32.856: WARN/System.err(1567): at org.apache.harmony.security.fortress.Engine.notFound(Engine.java:177)

08-09 11:06:32.856: WARN/System.err(1567): at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:151)

08-09 11:06:32.856: WARN/System.err(1567): 在 java.security.KeyStore.getInstance(KeyStore.java:116)

08-09 11:06:32.856: WARN/System.err(1567): ... 还有 5 个


这是添加您的代码后我现在收到的 logcat 消息..

08-09 11:35:34.469: WARN/System.err(1733): java.lang.NullPointerException
08-09 11:35:34.469: WARN/System.err(1733):     at java.io.File.fixSlashes(File.java:185)
08-09 11:35:34.469: WARN/System.err(1733):     at java.io.File.<init>(File.java:134)
08-09 11:35:34.469: WARN/System.err(1733):     at java.io.FileInputStream.<init>(FileInputStream.java:105)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.ServerTrustManager.<init>(ServerTrustManager.java:71)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:871)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
08-09 11:35:34.469: WARN/System.err(1733):     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)

它没有引用我的代码中的任何行...

08-09 11:57:32.126: W/BackupManagerService(868): dataChanged but no participant pkg='com.android.providers.settings' uid=1001
08-09 11:57:32.147: W/NetworkManagementSocketTagger(868): setKernelCountSet(10012, 0) failed with errno -2
08-09 11:57:32.198: W/System.err(1497): java.lang.NullPointerException
08-09 11:57:32.198: W/System.err(1497):     at java.io.File.fixSlashes(File.java:185)
08-09 11:57:32.198: W/System.err(1497):     at java.io.File.<init>(File.java:134)
08-09 11:57:32.198: W/System.err(1497):     at java.io.FileInputStream.<init>(FileInputStream.java:105)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.ServerTrustManager.<init>(ServerTrustManager.java:71)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:871)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:221)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
08-09 11:57:32.198: W/System.err(1497):     at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
4

1 回答 1

5

这就是我的处理方式

ConnectionConfiguration config = new ConnectionConfiguration("your_server", port_no);
config.setSASLAuthenticationEnabled(true);
config.setCompressionEnabled(true);
config.setSecurityMode(SecurityMode.enabled);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    config.setTruststoreType("AndroidCAStore");
    config.setTruststorePassword(null);
    config.setTruststorePath(null);
} else {
    config.setTruststoreType("BKS");
    String path = System.getProperty("javax.net.ssl.trustStore");
    if (path == null)
        path = System.getProperty("java.home") + File.separator + "etc"
            + File.separator + "security" + File.separator
            + "cacerts.bks";
    config.setTruststorePath(path);
}
于 2013-08-09T06:02:20.270 回答