我使用的Chromecast应用已经上市了一段时间。我们开始接收报告,说明人们在启动后第一次尝试无法连接到Chromecast。直到最近我们才能重现这一点(并且只有一个设备恰好表现出这种行为)
Chromecast图标显示已连接,但该应用永远不会启动。最终,Chromecast图标显示已断开连接。我从这个设备上抓了一个logcat。
D/CastSocket( 1037): [MiniDeviceController-1] onWritable when state is 1
D/CastSocket( 1037): [MiniDeviceController-1] SSLException encountered. Tearing down the socket.
D/CastSocket( 1037): javax.net.ssl.SSLException: Error occured in delegated task:javax.net.ssl.SSLException: Not trusted server certificate
D/CastSocket( 1037): at com.android.org.conscrypt.HandshakeProtocol.fatalAlert(HandshakeProtocol.java:316)
D/CastSocket( 1037): at com.android.org.conscrypt.HandshakeProtocol.wrap(HandshakeProtocol.java:268)
D/CastSocket( 1037): at com.android.org.conscrypt.SSLEngineImpl.wrap(SSLEngineImpl.java:693)
D/CastSocket( 1037): at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:438)
D/CastSocket( 1037): at beb.k(SourceFile:671)
D/CastSocket( 1037): at bef.run(SourceFile:96)
D/CastSocket( 1037): at java.lang.Thread.run(Thread.java:841)
D/CastSocket( 1037): Caused by: com.android.org.conscrypt.AlertException: javax.net.ssl.SSLException: Not trusted server certificate
D/CastSocket( 1037): at com.android.org.conscrypt.HandshakeProtocol.fatalAlert(HandshakeProtocol.java:316)
D/CastSocket( 1037): at com.android.org.conscrypt.ClientHandshakeImpl.verifyServerCert(ClientHandshakeImpl.java:559)
D/CastSocket( 1037): at com.android.org.conscrypt.ClientHandshakeImpl.processServerHelloDone(ClientHandshakeImpl.java:373)
D/CastSocket( 1037): at com.android.org.conscrypt.ClientHandshakeImpl$1.run(ClientHandshakeImpl.java:283)
D/CastSocket( 1037): at com.android.org.conscrypt.DelegatedTask.run(DelegatedTask.java:36)
D/CastSocket( 1037): at beb.a(SourceFile:721)
D/CastSocket( 1037): at beb.j(SourceFile:635)
D/CastSocket( 1037): ... 2 more
D/CastSocket( 1037): Caused by: javax.net.ssl.SSLException: Not trusted server certificate
D/CastSocket( 1037): ... 9 more
D/CastSocket( 1037): Caused by: java.security.cert.CertificateNotYetValidException
D/CastSocket( 1037): at com.android.org.conscrypt.OpenSSLX509Certificate.checkValidity(OpenSSLX509Certificate.java:216)
D/CastSocket( 1037): at com.android.org.conscrypt.OpenSSLX509Certificate.checkValidity(OpenSSLX509Certificate.java:209)
D/CastSocket( 1037): at bdu.checkServerTrusted(SourceFile:47)
D/CastSocket( 1037): at com.android.org.conscrypt.ClientHandshakeImpl.verifyServerCert(ClientHandshakeImpl.java:556)
D/CastSocket( 1037): ... 7 more
D/CastSocketMultiplexer( 1037): *** removing socket CastSocket:MiniDeviceController-1 (onWritable)
D/CastSocket( 1037): [MiniDeviceController-1] doTeardown with reason=4
D/DeviceFilter( 1037): DEACTIVATE MiniDeviceController-1; finished=false
D/DeviceFilter( 1037): socket is disconnected
D/CastMediaRouteProvider( 1037): onDeviceFilterError for 516b4a3a710d7bdfe8dc75ff4c4901a0: connection failed: error=4
这似乎是Google Play服务中的Chromecast API中的全部内容。我们使用Amazon S3来托管和使用他们的SSL证书。看起来很奇怪,在这个初始错误之后,设备会连接起来。我无法围绕这一个缠绕我的大脑。我们的应用仅适用于Android设备,并非所有设备都会出现此行为。
答案 0 :(得分:0)
当客户端的时钟关闭时,通常会发生“CertificateNotYetValidException”异常。也许遇到此问题的用户过去会设置其当前日期。您可以通过将设备的当前日期更改为过去来重现此操作。