I’m using Google Cloud Speech-to-Text V2 in an Android (Java) app. With languageCode set to "ja-JP" or "en-US", streaming recognition works perfectly. As soon as I switch only the language code to "cmn-Hans-CN", the call fails immediately with a CANCELLED error.
Environment & Config:
Relevant code snippet:
// Build recognition config RecognitionConfig config = RecognitionConfig.newBuilder() .setModel("chirp_2") .setLanguageCode("cmn-Hans-CN") // ← fails here .build(); StreamingRecognitionConfig streamingConfig = StreamingRecognitionConfig.newBuilder() .setConfig(config) .build(); // Start streaming try (SpeechClient client = SpeechClient.create( SpeechSettings.newBuilder() .setEndpoint("us-central1-speech.googleapis.com:443") .build())) { ClientStream<StreamingRecognizeRequest> stream = client.streamingRecognizeCallable() .splitCall(responseObserver); // First request with config stream.send(StreamingRecognizeRequest.newBuilder() .setStreamingConfig(streamingConfig) .build()); // Then send audio data... } catch (Exception e) { Log.e("SpeechTest", "Streaming failed", e); }
Error Log:
com.google.api.gax.rpc.CancelledException:
io.grpc.StatusRuntimeException: CANCELLED: The operation was cancelled. at
com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:…) at
com.google.cloud.speech.v2.StreamingRecognizeClient.streamingRecognizeCallable(StreamingRe
cognizeClient.java:…) … 05-14 16:42:40.052 26220 26279 E MyApp:
com.google.api.gax.rpc.CancelledException: io.grpc.StatusRuntimeException: CANCELLED: The
operation was cancelled.
Confirmed that the same code/config works for ja-JP and en-US.
Tried both cmn-Hans-CN and zh-CN—both cancel immediately.
Verified network connectivity and valid credentials.
Google Cloud Speech-to-Text v2 with the Chirp_2 model doesn't support streaming for certain languages and regions — unfortunately, Vietnamese isn’t supported in my case.
That said, would you be willing to share the source code for an Android application using Google Cloud STT v2 with streaming? I’d love to experiment with it, but I haven’t been able to find any sample projects or documentation.
I'm not an Android developer by training, so any example would be incredibly helpful.
Thank you so much in advance if you’re able to share!