我使用生成的应用引擎Android客户端(jar lib)。 31个客户中有30个没有问题。但是一个三星平板电脑拒绝连接并导致崩溃:
Android:4.4.4 制造商:samsung型号:SM-T533 - 日期:Mon Aug 03 09:49:03 CEST 2015
javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException:SSL握手已中止: ssl = 0x743164d0:SSL库失败,通常是协议错误 错误:1407743E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1 alert 不合适的后备(外部/ openssl / ssl / s23_clnt.c:744 0x74509f1c:0x00000000)at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:449) 在com.android.okhttp.Connection.upgradeToTls(Connection.java:146) 在com.android.okhttp.Connection.connect(Connection.java:107)at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) 在 com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) 在 com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) 在 com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) 在 com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296) 在 com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503) 在 com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:136) 在 com.google.api.client.http.javanet.NetHttpResponse。(NetHttpResponse.java:37) 在 com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:94) 在 com.google.api.client.http.HttpRequest.execute(HttpRequest.java:972) 在 com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419) 在 com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352) 在 com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469) 在 nl.stackoverflow.question.RestoreDataLoader.loadInBackground(RestoreDataLoader.java:37) 在 nl.stackoverflow.question.RestoreDataLoader.loadInBackground(RestoreDataLoader.java:20) 在 android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:312) 在 android.content.AsyncTaskLoader $ LoadTask.doInBackground(AsyncTaskLoader.java:69) 在 android.content.AsyncTaskLoader $ LoadTask.doInBackground(AsyncTaskLoader.java:57) 在android.os.AsyncTask $ 2.call(AsyncTask.java:288)at java.util.concurrent.FutureTask.run(FutureTask.java:237)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 在 java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:587) 在java.lang.Thread.run(Thread.java:841)引起: javax.net.ssl.SSLProtocolException:SSL握手已中止: ssl = 0x743164d0:SSL库失败,通常是协议错误 错误:1407743E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1 alert 不合适的后备(外部/ openssl / ssl / s23_clnt.c:744 0x74509f1c:0x00000000)at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(原生方法) 在 com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:406) ......还有25个
ApiUtils类:
/**
* Sales API Utility functions
*
* Created by Roel de Brouwer on 29-4-2015.
*/
public class ApiUtils {
public static final String APP_NAME = BuildConfig.APP_NAME;
public static final String WEB_CLIENT_ID = BuildConfig.WEBCLIENT_ID;
public static final String AUDIENCE = "server:client_id:" + WEB_CLIENT_ID;
/**
* Class instance of the HTTP transport.
*/
public static final HttpTransport HTTP_TRANSPORT = AndroidHttp.newCompatibleTransport();
/**
* Class instance of the JSON factory.
*/
public static final JsonFactory JSON_FACTORY = new AndroidJsonFactory();
private Context mContext;
private String mAccountName;
public ApiUtils(Context context, String accountName){
this.mContext = context;
this.mAccountName = accountName;
}
private GoogleAccountCredential getCredential(){
GoogleAccountCredential credential = GoogleAccountCredential.usingAudience(mContext, AUDIENCE);
credential.setSelectedAccountName(mAccountName);
return credential;
}
/**
* Retrieve a Sales api service handle to access the API.
*/
public Sales getApiServiceHandle() {
// Use a builder to help formulate the API request.
Sales.Builder salesAPI = new Sales.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredential());
Log.d("RootURL", salesAPI.getRootUrl());
salesAPI.setApplicationName(APP_NAME);
return salesAPI.build();
}
/**
* @return Sales Api
*/
public Sales.SalesAPI getApi(){
return getApiServiceHandle().salesAPI();
}
}
答案 0 :(得分:1)
将平板电脑更新到最新的操作系统版本(三星瘫痪)修复了问题。 (仍然基于Android 4.4.4)