StorageServiceAccountSample应用程序报告“未找到KeyStore JKS实现”

时间:2013-09-18 02:07:56

标签: android google-api-java-client

StorageServiceAccountSample

的第一行
HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

导致“未找到KeyStore JKS实现”:

W/System.err(20142): java.security.KeyStoreException: java.security.NoSuchAlgorithmException: KeyStore JKS implementation not found
W/System.err(20142):    at java.security.KeyStore.getInstance(KeyStore.java:119)
W/System.err(20142):    at com.google.api.client.util.SecurityUtils.getJavaKeyStore(SecurityUtils.java:48)
W/System.err(20142):    at com.google.api.client.googleapis.GoogleUtils.getCertificateTrustStore(GoogleUtils.java:74)
W/System.err(20142):    at com.google.api.client.googleapis.javanet.GoogleNetHttpTransport.newTrustedTransport(GoogleNetHttpTransport.java:55)

当我读到Android不支持JKS时,我应该如何修改此方法来解决它?

2 个答案:

答案 0 :(得分:10)

代替

HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

HTTP_TRANSPORT = AndroidHttp.newCompatibleTransport();

问题消失了。

答案 1 :(得分:2)

我在google issue tracker.

找到了答案

替换

HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

HTTP_TRANSPORT = new com.google.api.client.http.javanet.NetHttpTransport()

但不知道,它是如何运作的。