dialogflow / dialogflow-android-client

Android SDK for Dialogflow
https://dialogflow.com
Apache License 2.0
575 stars 270 forks source link

ai.api.AIServiceException: Can't connect to the api.ai service. #22

Open qingdaofu1 opened 7 years ago

qingdaofu1 commented 7 years ago

Hi, i face a issue: when i use some speech recognition api like bing speech 、nuance or ibm, it can work fine. but when i use the google cloud speech api, the github demo url is https://github.com/GoogleCloudPlatform/android-docs-samples/tree/master/speech/Speech. the google speech api use grpc, when i use this, happen the issue like title. the log like below:

i.api.AIServiceException: Can't connect to the api.ai service. System.err: at ai.api.AIDataService.doTextRequest(AIDataService.java:389) System.err: at ai.api.AIDataService.request(AIDataService.java:147) System.err: at ai.api.AIDataService.request(AIDataService.java:117) System.err: at com.amyrobotics.amya_one.main.HardWakeMutualVoiceService$6.doInBackground(HardWakeMutualVoiceService.java:511) System.err: at com.amyrobotics.amya_one.main.HardWakeMutualVoiceService$6.doInBackground(HardWakeMutualVoiceService.java:506) System.err: at android.os.AsyncTask$2.call(AsyncTask.java:292) System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237) System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) System.err: at java.lang.Thread.run(Thread.java:818) System.err: Caused by: javax.net.ssl.SSLHandshakeException: Handshake failed System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:390) System.err: at com.android.okhttp.Connection.upgradeToTls(Connection.java:201) System.err: at com.android.okhttp.Connection.connect(Connection.java:155) System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:276) System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211) System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:382) System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:106) System.err: at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.connect(DelegatingHttpsURLConnection.java:89) System.err: at com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:25) System.err: at ai.api.AIDataService.doTextRequest(AIDataService.java:368) System.err: ... 10 more System.err: Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xaf458600: Failure in SSL library, usually a protocol error System.err: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:770 0xac139001:0x00000000) System.err: at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) System.err: at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:318) System.err: ... 19 more I/System.out: error messageis Can't connect to the api.ai service.

where the error occured is in the program below:

final AIRequest aiRequest = new AIRequest(text); new AsyncTask<AIRequest, Void, AIResponse>() { @Override protected AIResponse doInBackground(AIRequest... requests) {

i suspect the error is about the port "443", used in google cloud speech for "setAccessToken".

but i change the port of google speech to 442, it did't work, and google speech error. so i don't kown how to solve this, please help; i don't kown ho

sankari1990 commented 7 years ago

Hi, am also facing same error. Did you found solution for this?

shirshshukla commented 5 years ago

its may be internet issue check your mobile network connection.