Giter Site home page Giter Site logo

android-docs-samples's Introduction

status: inactive

This project is no longer actively developed or maintained.

Android Docs Samples

CircleCI

This is a repository that contains Android code snippets on Google Cloud Platform Documentation.

Getting the sample code

Get the latest sample code from GitHub using Git or download the repository as a ZIP file. (Download)

git clone https://github.com/GoogleCloudPlatform/android-docs-samples.git

Before you begin

  1. Download and install the Google Cloud SDK, which includes the gcloud command-line tool.

  2. Create a new Google Cloud Platform project from the Cloud Console or use an existing one.

Available Samples

Contributing changes

Licensing

android-docs-samples's People

Contributors

egglang avatar frankyn avatar jbolinger avatar kurtisvg avatar lesv avatar nnegrey avatar parkjam4 avatar puneithk avatar rishavjalan avatar yaraki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-docs-samples's Issues

Not able to build the code

While building the source code I am getting following error,

/Users/aditya/Projects/Experimental/google-cloud/android-docs-samples/speech/Speech/app/src/main/java/com/google/cloud/android/speech/SpeechService.java
Error:(295, 72) error: cannot find symbol variable raw

io.grpc.StatusRuntimeException: UNAVAILABLE: Channel in TRANSIENT_FAILURE state/UNAVAILABLE

 Caused by: java.lang.IllegalStateException: 
    OAuth2Credentials instance does not support refreshing the access token.
    An instance with a new access token should be used, 
    or a derived type that supports refreshing should be used.
final GoogleCredentials credentials = ServiceAccountCredentials.fromStream(stream)
                        .createScoped(SCOPE);
final AccessToken token = credentials.refreshAccessToken();

Some how I just can't refresh the access token even I generate another credential.json , using an Compute Engine default service account .
I see ServiceAccountCredentials does override refreshAccessToken(), so I replaced it , still not work.

SpeechService: API not ready.

We see that SpeechService: API not ready. Ignoring the request. sometimes in logs. What does it mean.. when it happens seems engine won't listen for anything. HOw do we need to handle such cases ? Do we get any callbacks for it?

Support for Android < 5.0

The demo will fail for Android devices running < 5.0 due to the missing security provider update:

ProviderInstaller.installIfNeeded(mContext);

Doc link.

A check for a successful response would be needed prior to anything else initialising, otherwise it will throw a TRANSIENT_FAILURE

Ben

Adding canonicalName on Endpoint does not work

Adding canonicalName on MyEndpoint does not change the name of the generated class. Not sure if this is a bug with the generator or the gradle configuration, but if it is the later, will be nice to include that in the sample

Adding canonicalName in the code below, does not generate a Service Client with name SampleAPI
@Api( name = "myApi", version = "v1", canonicalName = "SampleAPI", namespace = @ApiNamespace( ownerDomain = "backend.endpoints.migration.example.com", ownerName = "backend.endpoints.migration.example.com", packagePath = "" ) ) public class MyEndpoint { ...

Getting io.grpc.StatusRuntimeException

Hi,

I am getting following error while transcribing long audio:

Error calling the API.
io.grpc.StatusRuntimeException: UNKNOWN
at io.grpc.Status.asRuntimeException(Status.java:545)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:370)
at io.grpc.ClientInterceptors$CheckedForwardingClientCall.start(ClientInterceptors.java:203)
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:248)
at io.grpc.stub.ClientCalls.asyncStreamingRequestCall(ClientCalls.java:241)
at io.grpc.stub.ClientCalls.asyncBidiStreamingCall(ClientCalls.java:106)
at com.google.cloud.speech.v1beta1.SpeechGrpc$SpeechStub.streamingRecognize(SpeechGrpc.java:232)
at com.google.cloud.android.speech.ApiFragment.startRecognizing(ApiFragment.java:188)
at com.google.cloud.android.speech.MainActivity$1.onVoiceStart(MainActivity.java:64)
at com.google.cloud.android.speech.VoiceRecorder$ProcessVoice.run(VoiceRecorder.java:201)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalStateException: OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing should be used.
at com.google.auth.oauth2.OAuth2Credentials.refreshAccessToken(OAuth2Credentials.java:115)
at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:97)
at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:74)
at com.google.cloud.android.speech.ApiFragment$GoogleCredentialsInterceptor.getRequestMetadata(ApiFragment.java:326)
at com.google.cloud.android.speech.ApiFragment$GoogleCredentialsInterceptor.access$200(ApiFragment.java:244)
at com.google.cloud.android.speech.ApiFragment$GoogleCredentialsInterceptor$1.checkedStart(ApiFragment.java:268)
at io.grpc.ClientInterceptors$CheckedForwardingClientCall.start(ClientInterceptors.java:195)
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:248) 
at io.grpc.stub.ClientCalls.asyncStreamingRequestCall(ClientCalls.java:241) 
at io.grpc.stub.ClientCalls.asyncBidiStreamingCall(ClientCalls.java:106) 
at com.google.cloud.speech.v1beta1.SpeechGrpc$SpeechStub.streamingRecognize(SpeechGrpc.java:232) 
at com.google.cloud.android.speech.ApiFragment.startRecognizing(ApiFragment.java:188) 
at com.google.cloud.android.speech.MainActivity$1.onVoiceStart(MainActivity.java:64) 
at com.google.cloud.android.speech.VoiceRecorder$ProcessVoice.run(VoiceRecorder.java:201) 
at java.lang.Thread.run(Thread.java:818) 

I cannot find out the reason for this issue.

how to biuld with android.mk

my project is use android.mk to build,but I don't know how to edit the android.mk file to build proto files,can you do me a favor ?

Does not work on android 4.4?

Last year, we worked with android 4.4 on the sample source.
However, after the update, an error occurs during build.
but, It works in android 5.1.
Does the current source work only with android 5.0 or higher?

Google Speech cannot operate on EPSON BT-2000

I try to apply Google Speech to EPSON BT-2000 but not working without throw exception. I try debugging then I detect it don't step into onVoiceStart,onVoice, onVoiceEnd method. Please help me. Thank you very much.

Unable to addAlternativeLanguageCodes

Can you share how to use the auto language detection feature described here? The GCP Cloud Java client has this method addAlternativeLanguageCodes in RecognitionConfig... but I can't seem to be able to do the same using this sample. (I understand this sample uses the generated protobuf classes.)

Any hints?

image

Adding Flac Encoder

Hi,
Thanks for great work,

I wanted to ask if there is any plan to implement Flac encoder instead of raw file format?

Thank you

SSLHandshakeException

I had an error when run this code on Android device.
Do anybody know how to fix it?

2017-07-09 8 53 22

proto/Google

Hi!,

Built the example no problem.

Tried to remake it, in my own App, but needed "proto/Google" directory.

Where did this come from?

Thanks!

MrMechis

Speech Service reset for every 30 sec

We have an application where we want to be in continuous listen for voice/speech. But as per the sample voice recorder has tor set for every 30 seconds.
Is there a limitation on VoiceRecorder that it has to reset on certain time?, we want to have continuous voice recorder without reset?
As a work around we we are reseting the resetting the service but we are getting lag in recognition.

The project cannot build after Android Studio upgraded to 3.0

Greeting,

I use Android Studio on Windows 10.
Today I got a prompt upgrading my studio to 3.0. Then I can no longer build this project. I need to edit various gradle files to use lower buildToolsVersion (25.0.3) and to specify distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip for it to build.

Is this a known issue? The error I got includes all flavors should belong to some dimension, and (after fixing that), some gradle build dependencies not resolved.

Thanks,

Chun-Yen

Input output both languages

Like it is working in google translate app, it is listening and translating in two languages at a time , how to implement that

Low Network Streaming Slow

i am getting fast response when i have good network connectivity but in bad network it is not working fine and i am same implementation and using same samples of code.Sometimes it takes time to give error(Error:Audio Streaming is very slow). i was also trying to use Default Android Speech Api run simultaneously so that i can get user text. but its allow only one between AudioRecord or Recognize Intent run at one time to listen. So how to handle Speech Cloud api with local Speech listener So that i can get User Speech text even in low bandwidth like google assistant prints user text in low bandwidth ?

io.grpc.StatusRuntimeException: OUT_OF_RANGE: Audio data is being streamed too slow. Please stream audio data approximately at real time.

07-25 18:15:52.504 12312-12312/com.google.cloud.android.speech D/HwCust: Create obj success use class android.widget.HwCustTextViewImpl
07-25 18:15:52.504 12312-12312/com.google.cloud.android.speech D/HwCust: Create obj success use class android.widget.HwCustTextViewImpl
07-25 18:15:52.784 12312-12735/com.google.cloud.android.speech I/SpeechService: API completed.
07-25 18:16:23.064 12312-12735/com.google.cloud.android.speech I/SpeechService: API completed.
07-25 18:16:53.034 12312-12735/com.google.cloud.android.speech E/SpeechService: Error calling the API.
io.grpc.StatusRuntimeException: OUT_OF_RANGE: Audio data is being streamed too slow. Please stream audio data approximately at real time.
at io.grpc.Status.asRuntimeException(Status.java:543)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:833)
07-25 18:17:09.484 12312-12312/com.google.cloud.android.speech V/AudioManager: preDispatchKeyEvent keycode: 4 stream: -2147483648
07-25 18:17:09.564 12312-12312/com.google.cloud.android.speech V/AudioManager: preDispatchKeyEvent keycode: 4 stream: -2147483648
07-25 18:17:10.084 12312-12312/com.google.cloud.android.speech I/View: ssignParent(ViewParent parent) parent is: null
07-25 18:17:10.094 12312-12312/com.google.cloud.android.speech I/View: ssignParent(ViewParent parent) parent is: null

Gradle and Maven Version Problem

There are problems in AndroidStudio(3.2.1).

  • To change my Gradle version [UP] - Not Working
  • To change my Build-Tool version [UP] - Not Working
  • To Add sentences with Maven or google() - Not Working

Please migrate this source version up or provide the detail solutions...

Speech Sample: Error calling the API, io.grpc.StatusRuntimeException: UNAVAILABLE on Android 4.4.4

Can't run this sample on android 4.4.4
This error appears:

03-21 17:59:27.728 17869-27213/com.testgoogle E/SpeechService: Error calling the API.
io.grpc.StatusRuntimeException: UNAVAILABLE
at io.grpc.Status.asRuntimeException(Status.java:543)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.net.ConnectException: failed to connect to speech.googleapis.com/2404:6800:4005:809::200a (port 443): connect failed: ENETUNREACH (Network is unreachable)
at libcore.io.IoBridge.connect(IoBridge.java:114)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.Socket.startupSocket(Socket.java:566)
at java.net.Socket.(Socket.java:226)
at io.grpc.okhttp.OkHttpClientTransport$1.run(OkHttpClientTransport.java:427)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841) 
Caused by: libcore.io.ErrnoException: connect failed: ENETUNREACH (Network is unreachable)
at libcore.io.Posix.connect(Native Method)
at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
at libcore.io.IoBridge.connect(IoBridge.java:112)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) 
at java.net.Socket.startupSocket(Socket.java:566) 
at java.net.Socket.(Socket.java:226) 
at io.grpc.okhttp.OkHttpClientTransport$1.run(OkHttpClientTransport.java:427) 
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841) 

Why there is a restriction for MAX_SPEECH_LENGTH

We see that there is a delay when there is no speech is recognized after certain time and start the speech after 30 sec.
if (now - mVoiceStartedMillis > MAX_SPEECH_LENGTH_MILLIS) {
end();
}
} else if (mLastVoiceHeardMillis != Long.MAX_VALUE) {
mCallback.onVoice(mBuffer, size);
if (now - mLastVoiceHeardMillis > SPEECH_TIMEOUT_MILLIS) {
end();
}
Any specific reason that it needs to be end and start again after MAX_SPEECH_LENGTH_MILLIS(30sec)and Speech Timeout i.e 20 sec ?

Permission denied?

I enabled my cloud speech api, got a service account and downloaded the json and placed it in the /res/raw directory.
However, when I try to run the demo. I keep getting a Permission denied error.
Any help? I have no idea what is wrong.

01-11 12:15:59.638 22938-23044/com.google.cloud.android.speech E/SpeechService: Error calling the API.
io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission denied: Consumer 'project_number:1082880516923' has been suspended.
at io.grpc.Status.asRuntimeException(Status.java:543)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)

it have a influence on my api.ai

Hi, i face a issue:
i integrate the speech recognition with api.ai.
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, thttps://github.com/api-ai/api-ai-android-sdk
the google speech api use grpc, when i use this, my api.ai can't connect to api.ai service. will you offer some help . thanks;
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;

Use with protobuf-lite possible?

protobuf-lite is apparently the recommended implementation for Android (see https://github.com/google/protobuf-gradle-plugin). Is it possible to use the Speech API with it? I tried to upgrade and migrate the samples but ran into numerous errors, for example:

google/api/annotations.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.

Generally it would be nice if the dependencies of the sample could be updated.

Not getting any result

Basically, i built the app from this sample code with including raw file.

After simulate my android phone and also virtual device, i am not getting any results from it. i am wondering what is the problem?

I also checked the google cloud platform, and all the speech request results with error

Configuration with name 'prodDebugAndroidTestCompile' not found.

Hi, I get the following when I try to sync the gradle

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:666)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:135)
at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:249)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:167)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:126)
at org.gradle.initialization.DefaultGradleLauncher.getConfiguredBuild(DefaultGradleLauncher.java:104)
at org.gradle.internal.invocation.GradleBuildController$2.call(GradleBuildController.java:87)
at org.gradle.internal.invocation.GradleBuildController$2.call(GradleBuildController.java:84)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.configure(GradleBuildController.java:84)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:64)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:69)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'prodDebugAndroidTestCompile' not found.
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:140)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:229)
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:130)
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:50)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getAt(DefaultNamedDomainObjectCollection.java:248)
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getAt(DefaultConfigurationContainer.java:50)
at org.gradle.api.artifacts.ConfigurationContainer$getAt.call(Unknown Source)
at com.google.protobuf.gradle.ProtobufPlugin$_maybeAddExtractIncludeProtosTask_closure18.doCall(ProtobufPlugin.groovy:341)
at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:136)
at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:634)
at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:86)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:104)
at org.gradle.util.ConfigureUtil$1.execute(ConfigureUtil.java:123)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:148)
at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated.create(Unknown Source)
at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated$create.call(Unknown Source)
at com.google.protobuf.gradle.ProtobufPlugin.maybeAddExtractIncludeProtosTask(ProtobufPlugin.groovy:338)
at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.google.protobuf.gradle.ProtobufPlugin$_addTasksForVariant_closure15.doCall(ProtobufPlugin.groovy:245)
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2066)
at org.codehaus.groovy.runtime.dgm$163.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.google.protobuf.gradle.ProtobufPlugin.addTasksForVariant(ProtobufPlugin.groovy:241)
at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at com.google.protobuf.gradle.ProtobufPlugin$_addProtoTasks_closure9.doCall(ProtobufPlugin.groovy:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2078)
at org.codehaus.groovy.runtime.dgm$165.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.google.protobuf.gradle.ProtobufPlugin.addProtoTasks(ProtobufPlugin.groovy:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:158)
at com.google.protobuf.gradle.ProtobufPlugin$_doApply_closure5.doCall(ProtobufPlugin.groovy:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy30.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)
... 85 more

simpler code

is there a simple code??
i want to do rest command, send some data and get a result.
it's strange that all other cloud platform give easy tools, and in google we need to deal with all this code.

can you address me to simple code and not a complex one

Integrate pre-recorded audio file

Using this project I can convert speech to text but I want to convert already recorded audio file into text file. How can I do that? Please help. Thank You.

The request is missing a valid API key

i build the nl/Language project in androidstudio,and install it in my huawei honor 8 ,but there are something wrong
like the pic show , if someone konw the reason please reply me ,thanks
_15254272953577

screenshot_20180504-175144

Speechservice is not working on Android o

Hello Team,

I am Implementing speech to text sample on Android and using this sample, this is working on Android 7 and 6 properly, but not on Android 8. I have converted service to foreground but still not working up to the point.

For Android 8.0 do we need to make any more changes, please let me know

Thanks,
Bhuvana

How to implement Getting Punctuation ?

Hello,

I am trying to implement new Google Speech to Text feature Getting Punctuation. But I couldn t find out how to update library in Android Studio or any google documentation about it. Is there any one achieved that or any one can point me a direction ?

https://cloud.google.com/speech-to-text/docs/automatic-punctuation
.setEnableAutomaticPunctuation(true) ---> In google doc in the link above says I need to add this line
but there is no such a param in android-docs-samples.

Thanks,
Arda Kaya

Build faild after adding translation lib in gradle

Hi,
I am trying to add google cloud translation feature in your speech sample, so modified gradle dependency. But I am getting some errors when building APK . Below are my codes:
...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/io.netty.versions.properties'
exclude 'META-INF/INDEX.LIST'

}

....
...
compile('com.google.apis:google-api-services-translate:v2-rev47-1.22.0') {
exclude group: 'com.google.guava'
exclude module: 'jsr305'
}

compile('com.google.cloud:google-cloud-translate:0.8.2-alpha') {
exclude group: 'io.grpc', module: 'grpc-all'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.api-client', module: 'google-api-client-appengine'
exclude module: 'jsr305'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
...
...

The errors are:

E:\tempt_test\Speech\app\build\generated\source\proto\devDebug\java\com\google\longrunning\Operation.java:741: Error: The type parameter FloatValue is not within the scope of the type variable MType
com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> metadataBuilder_;

E:\tempt_test\Speech\app\build\generated\source\proto\devDebug\java\com\google\longrunning\Operation.java:906: Error: The type parameter Any is not within the scope of the type variable MType
com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>
...
E:\tempt_test\Speech\app\build\generated\source\proto\devDebug\java\com\google\rpc\Status.java:722: Error: The type parameter Any is not within the scope of the type variable MType
com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> detailsBuilder_;
...
BUILD FAILED
There are totally 24 errors like these.

If using "com.google.cloud:google-cloud-translate:0.5.0", it works well! I don't understand......

So how should I write the dependency ?

"Error:(354, 76) error: cannot find symbol variable credential"

I am new to google cloud api. I was able to create a private key and I set the environment variable.I put the json private key in the res/raw folder but I still get the error "Error:(354, 76) error: cannot find symbol variable credential" . Could someone please help me on this. Are there any other things I need to do with gcloud to remove this error...Please let me know.

Output

Where will the output text be stored? How do I access that string?

proto build error

If I implementation 'com.google.cloud:google-cloud-speech:0.56.0-beta',when I run app it failed:“More than one file was found with OS independent path 'META-INF/INDEX.LIST'”,than I add
packagingOptions {
exclude 'META-INF/INDEX.LIST'
}
or delete implementation 'com.google.cloud:google-cloud-speech:0.56.0-beta',
sync error :“app\build\generated\source\proto\debug\grpc\com\google\logging\v2\LoggingServiceV2Grpc.java.$EST$ (The system can not find the specified file.)”

anybody know how to fix it?

Pausing the Speech Recognition Stream.

Im currently developing and Android app based on TextToSpeech and Voice Recognition, for Recognition i use Google Cloud Speech API all are working fine. But i have a problem on pausing the Speech Recognition. Im using the stopVoiceRecogonition method from their sample code provided by Google. The problem is that im shutting down the Speech Recognizer and that takes a bit time. But i need that instantly on button press. Because after the speech recognition is followed by TextToSpeech. and if the Speech Recognition is not shutdown in time it will start to recognize the TTS voice.
If I start TTS when the Speech Recognizer is shutdown. It breaks the smoothness of the app.
Searched everywhere. Also cant or there is not documentation about that either.

The problem is : The stopVoicerRecognition()
Analyzed with TraceView., it`s random ,sometimes is runs fast sometimes takes way long.
On the emulator is not that much frequent then real physical device.

  public void stop() {
    synchronized (mLock) {
    if (mThread != null) {
        mThread.interrupt();
        mThread = null;
    }

    dismiss();
    if (mAudioRecord != null) {
        mAudioRecord.stop();
    }

}
}`

This fuction if is running on Main Thread can skip 1000+ Frames . usually ~200

untitled

Race condition

The call:

mApi = SpeechGrpc.newStub(channel); link

Often takes over 1 second to return, longer with network latency.

If the voice recorder initialises prior to this and calls onVoiceStart() link

startRecognizing() will return immediately, causing the request observer to remain null

Subsequent calls will fail.

Ben

A question about longRunningRecognize with SpeechGrpc

I'm trying to perform longRunningRecognize which uses the SpeechGrpc api, the code is running without exceptions and after about a minute i get a response but the alternatives that i get in the result are empty, tried with a few files, i will be glad to understand what I'm doing wrong?

the code :

private SpeechGrpc.SpeechStub mApi;
private OperationsGrpc.OperationsStub operationApi;

public void recognizeLongGcs(String gcsUri) throws Exception {
try {
mApi.longRunningRecognize(LongRunningRecognizeRequest.newBuilder()
.setConfig(
RecognitionConfig.newBuilder()
.setEncoding(RecognitionConfig.AudioEncoding.FLAC)
.setLanguageCode("iw")
.setSampleRateHertz(16000)
.build())
.setAudio( RecognitionAudio.newBuilder().setUri(gcsUri).build())
.build(),
mLongFileResponseObserver);
}
catch (Exception e)
{ AnalyticsModel.getInstance().logError(this.getClass().getSimpleName() , e );
}
}

private final StreamObserver mLongFileResponseObserver
= new StreamObserver() {
Operation response;
String responseName;
@OverRide
public void onNext(Operation response) {
String text = null;
List words = null;
responseName =response.getName();
try {
if (response.getDone())
{
Any a = response.getResponse();
LongRunningRecognizeResponse longRunningRecognizeResponse = LongRunningRecognizeResponse.parseFrom(a.getValue());
final SpeechRecognitionResult result = longRunningRecognizeResponse.getResults(0);
if (result.getAlternativesCount() > 0) {
final SpeechRecognitionAlternative alternative = result.getAlternatives(0);
text = alternative.getTranscript();
words = alternative.getWordsList();
}
}
else {
Thread.sleep(10000);
operationApi.getOperation(GetOperationRequest.newBuilder().setName(responseName).build(), mLongFileResponseObserver);
}
}
catch (Exception e) { }
}

@Override
public void onError(Throwable t) {            
    Log.e(TAG, "Error calling the API.", t);
}

@Override
public void onCompleted() {
    Log.i(TAG, "API completed.");            
}

};

Speech - Restricted API key credential a valid authentication alternative?

With the Speech example would using an API key credential suitably restricted by package name and SHA-1 certificate fingerprint be a valid authentication alternative?

I am just not keen on creating and maintaining a server-side endpoint solely to obtain an access token, as suggested for production applications, if I can avoid it.

example not working with version 0.67.0-beta

I have upgraded the google-cloud-speech to version 0.67.0-beta and the example app is not responding.
Second, the bidiStreamingCall function is deprecated please make the change to splitCall().
Thanks

Error: OAuth2Credentials instance does not support refreshing the access token. How to create a AccessToken instance with token value string?

The sample runs successfully. But Alternatively, you should get the access token on the server side, and supply client app with it.

I set up a server and create RESTful api for app to get the access token.
{"token":"1234567890sdertyuikjhgfghjk....."}

And also use api: https://www.googleapis.com/oauth2/v1/tokeninfo?access_token={token} to get the token info:
{ "issued_to": "102073270616313859663", "audience": "102073270616313859663", "scope": "https://www.googleapis.com/auth/cloud-platform", "expires_in": 3600, "access_type": "offline" }

Then create a Token instance:
AccessToken token = new AccessToken(tokenValue, expiresIn);

But following error:

07-04 20:14:07.395 3023-3067/com.google.cloud.android.speech E/SpeechService: Error calling the API.
    io.grpc.StatusRuntimeException: UNKNOWN
        at io.grpc.Status.asRuntimeException(Status.java:543)
        at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
        at io.grpc.ClientInterceptors$CheckedForwardingClientCall.start(ClientInterceptors.java:202)
        at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:276)
        at io.grpc.stub.ClientCalls.asyncStreamingRequestCall(ClientCalls.java:266)
        at io.grpc.stub.ClientCalls.asyncBidiStreamingCall(ClientCalls.java:106)
        at com.google.cloud.speech.v1.SpeechGrpc$SpeechStub.streamingRecognize(SpeechGrpc.java:217)
        at com.google.cloud.android.speech.SpeechService.startRecognizing(SpeechService.java:264)
        at com.google.cloud.android.speech.MainActivity$1.onVoiceStart(MainActivity.java:62)
        at com.google.cloud.android.speech.VoiceRecorder$ProcessVoice.run(VoiceRecorder.java:199)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.IllegalStateException: OAuth2Credentials instance does not support refreshing the access token. An instance with a new access token should be used, or a derived type that supports refreshing.
        at com.google.auth.oauth2.OAuth2Credentials.refreshAccessToken(OAuth2Credentials.java:208)
        at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:175)
        at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:161)
        at com.google.cloud.android.speech.SpeechService$GoogleCredentialsInterceptor.getRequestMetadata(SpeechService.java:532)
        at com.google.cloud.android.speech.SpeechService$GoogleCredentialsInterceptor.access$900(SpeechService.java:450)
        at com.google.cloud.android.speech.SpeechService$GoogleCredentialsInterceptor$1.checkedStart(SpeechService.java:474)
        at io.grpc.ClientInterceptors$CheckedForwardingClientCall.start(ClientInterceptors.java:194)
        at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:276) 
        at io.grpc.stub.ClientCalls.asyncStreamingRequestCall(ClientCalls.java:266) 
        at io.grpc.stub.ClientCalls.asyncBidiStreamingCall(ClientCalls.java:106) 
        at com.google.cloud.speech.v1.SpeechGrpc$SpeechStub.streamingRecognize(SpeechGrpc.java:217) 
        at com.google.cloud.android.speech.SpeechService.startRecognizing(SpeechService.java:264) 
        at com.google.cloud.android.speech.MainActivity$1.onVoiceStart(MainActivity.java:62) 
        at com.google.cloud.android.speech.VoiceRecorder$ProcessVoice.run(VoiceRecorder.java:199) 
        at java.lang.Thread.run(Thread.java:764) 

I could use the sample code:

 final InputStream stream = getResources().openRawResource(R.raw.credential);
 final GoogleCredentials credentials = 
 GoogleCredentials.fromStream(stream).createScoped(SCOPE);
 final AccessToken token = credentials.refreshAccessToken();

and get a working Token, and get its token value by using getTokenValue() and get it expiration time by getExpirationTime. Then create a Token instance:
AccessToken token = new AccessToken(tokenValue, expiresIn);
to return a AccessToken instance.

It will cause the same error. So my question is that how to create an working AccessToken instance when I get the token value string and the expiration time.

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.