运行示例API.AI Android应用程序的问题

时间:2017-06-13 13:55:36

标签: dialogflow

所以我创建了一个API.ai代理,并决定在Android设备上运行它。

我遵循了本教程:https://github.com/api-ai/apiai-android-client#running-the-sample-code

我按照步骤

中的指示添加了我的客户端/访问令牌

它编译并运行,但我有2个问题

(1)它不承认我的代理人的意图。它一直以不同的形式对我做出回应"对不起,我不理解"

(2)当我通过语音输入命令时崩溃

这是A-monitor日志:

31805-32386/ai.api.sample E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
                                                           Process: ai.api.sample, PID: 31805
                                                           java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                               at android.os.AsyncTask$3.done(AsyncTask.java:309)
                                                               at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                               at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                               at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                               at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
                                                               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                               at java.lang.Thread.run(Thread.java:818)
                                                            Caused by: java.lang.NumberFormatException: Invalid int: "simple_response"
                                                               at java.lang.Integer.invalidInt(Integer.java:138)
                                                               at java.lang.Integer.parse(Integer.java:410)
                                                               at java.lang.Integer.parseInt(Integer.java:367)
                                                               at java.lang.Integer.parseInt(Integer.java:334)
                                                               at com.google.gson.JsonPrimitive.getAsInt(JsonPrimitive.java:260)
                                                               at ai.api.GsonFactory$ResponseItemAdapter.deserialize(GsonFactory.java:78)
                                                               at ai.api.GsonFactory$ResponseItemAdapter.deserialize(GsonFactory.java:71)
                                                               at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)
                                                               at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
                                                               at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81)
                                                               at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
                                                               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:103)
                                                               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:196)
                                                               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:103)
                                                               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:196)
                                                               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:103)
                                                               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:196)
                                                               at com.google.gson.Gson.fromJson(Gson.java:810)
                                                               at com.google.gson.Gson.fromJson(Gson.java:775)
                                                               at com.google.gson.Gson.fromJson(Gson.java:724)
                                                               at com.google.gson.Gson.fromJson(Gson.java:696)
                                                               at ai.api.AIDataService.request(AIDataService.java:193)
                                                               at ai.api.AIDataService.request(AIDataService.java:148)
                                                               at ai.api.services.GoogleRecognitionServiceImpl$2.doInBackground(GoogleRecognitionServiceImpl.java:166)
                                                               at ai.api.services.GoogleRecognitionServiceImpl$2.doInBackground(GoogleRecognitionServiceImpl.java:158)
                                                               at android.os.AsyncTask$2.call(AsyncTask.java:295)
                                                               at java.util.concurrent.FutureTask.run

我在互联网上搜索过,但没有找到解决方案 任何帮助表示赞赏

由于

0 个答案:

没有答案