Я пытаюсь использовать речь Google, чтобы текст API для Android. Получение ошибки при установке учетных данных в speechClient - PullRequest
1 голос
/ 16 апреля 2019

Я хочу создать экземпляр объекта speechClient с учетными данными в Android. Чтобы использовать его позже для преобразования аудиовхода в текст.

Мой код выглядит так:

val speechSettings = SpeechSettings.newBuilder()
            .setCredentialsProvider(
                FixedCredentialsProvider.create(
                    GoogleCredentials.fromStream(
                        context.resources.openRawResource(R.raw.my_key_name)
                    )
                )
            )
            .build()

val speechClient = SpeechClient.create(speechSettings)

и в Gradle я добавил следующее:

implementation 'com.google.cloud:google-cloud-speech:0.80.0-beta'
implementation "io.grpc:grpc-okhttp:1.4.0"

Я получаю следующую ошибку при запуске приложения:

java.lang.AbstractMethodError: abstract method "java.util.concurrent.ScheduledExecutorService io.grpc.internal.ClientTransportFactory.getScheduledExecutorService()"

Полная трассировка стека:

Caused by: java.lang.AbstractMethodError: abstract method "java.util.concurrent.ScheduledExecutorService io.grpc.internal.ClientTransportFactory.getScheduledExecutorService()"
        at io.grpc.internal.CallCredentialsApplyingTransportFactory.getScheduledExecutorService(CallCredentialsApplyingTransportFactory.java:52)
        at io.grpc.internal.ManagedChannelImpl.<init>(ManagedChannelImpl.java:560)
        at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:419)
        at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:222)
        at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:164)
        at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:156)
        at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:157)
        at com.google.cloud.speech.v1.stub.GrpcSpeechStub.create(GrpcSpeechStub.java:94)
        at com.google.cloud.speech.v1.stub.SpeechStubSettings.createStub(SpeechStubSettings.java:126)
        at com.google.cloud.speech.v1.SpeechClient.<init>(SpeechClient.java:144)
        at com.google.cloud.speech.v1.SpeechClient.create(SpeechClient.java:126)
...