【问题标题】:Throwable = Malformed URL. Base: https://speech.googleapis.com/v1/, Relative: speech:longrunningrecognizeThrowable = 格式错误的 URL。基础:https://speech.googleapis.com/v1/,相对:speech:longrunningrecognize
【发布时间】:2017-08-17 09:16:35
【问题描述】:

我正在使用 Retrofit2 测试 Android 上的请求,我得到了这个 throwable。

URL_BASE = "https://speech.googleapis.com/v1/";

我的要求

@POST("speech:longrunningrecognize")
    Call<String> longRecognize(@Query("key") String key,
                               @Body LongRunningRecognize loginResponse);

点击时

btnInitialSpeech.setOnClickListener(v -> {
            RestClient.INSTANCE.getApiServiceInterface()
                    .longRecognize(GOOGLE_API_KEY, getLongRecognize(f.getName()))
                    .enqueue(new Callback<String>() {
                        @Override
                        public void onResponse(Call<String> call, Response<String> response) {
                            if (response.isSuccessful()) {
                                String body = String.valueOf(response.body());
                                Log.d(TAG, "Response = " + body);
                            }
                        }

                        @Override
                        public void onFailure(Call<String> call, Throwable t) {
                            Log.d(TAG, "Throwable = " + t.getMessage());

                        }
                    });
        });

我创建了项目并像这里一样做https://cloud.google.com/speech/docs/async-recognize 请告诉我有什么问题?

【问题讨论】:

    标签: android speech-recognition retrofit2 speech-to-text google-speech-api


    【解决方案1】:

    我想通了。

    这里speech:longrunningrecognize 而不是“:”需要“/”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-11
      • 1970-01-01
      • 2013-03-08
      • 1970-01-01
      • 2013-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多