Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android app - v3 advanced Translation - No functional channel service provider found #2944

Closed
eloisance opened this issue May 20, 2020 · 1 comment
Assignees
Labels
api: translation Issues related to the Cloud Translation API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: question Request for information or clarification. Not an issue.

Comments

@eloisance
Copy link

eloisance commented May 20, 2020

Try to use v3 advanced Translate API in my android app, getting this error when I tried to use service account credentials :

io.grpc.ManagedChannelProvider$ProviderNotFoundException: No functional channel service provider found. Try adding a dependency on the grpc-okhttp, grpc-netty, or grpc-netty-shaded artifact

Am I doing something wrong?

Gradle :

implementation 'com.google.cloud:google-cloud-translate:1.94.5'

My code :

val stream: InputStream = resources.openRawResource(com.example.R.raw.service_account)
val credentials = GoogleCredentials
    .fromStream(stream)
    .createScoped(Lists.newArrayList(Collections.singleton("https://www.googleapis.com/auth/cloud-platform")))

val translationServiceSettings = TranslationServiceSettings.newBuilder()
    .setCredentialsProvider(FixedCredentialsProvider.create(credentials))
    .build()

val client = TranslationServiceClient.create(translationServiceSettings)
val parent = LocationName.of("some_key", "global")

val request = TranslateTextRequest.newBuilder()
    .setParent(parent.toString())
    .setMimeType("text/plain")
    .setSourceLanguageCode("en")
    .setTargetLanguageCode("fr")
    .addContents(word)
    .build()

val response = client.translateText(request)
@stephaniewang526 stephaniewang526 removed their assignment May 20, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label May 20, 2020
@lesv lesv added api: translation Issues related to the Cloud Translation API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. labels May 20, 2020
@lesv
Copy link
Contributor

lesv commented May 20, 2020

We don't normally support Android out of our repos. You might wish to look at the Firebase documentation: https://firebase.google.com/docs/ml-kit/translation and I found a blog post, but I can't say how accurate it is.
https://medium.com/@yeksancansu/how-to-use-google-translate-api-in-android-studio-projects-7f09cae320c7

In general, if there is a Firebase or GMS Core (android) way, that is preferred to using our client libraries directly.

@JustinBeckwith FYI

@lesv lesv closed this as completed May 20, 2020
@tbpg tbpg assigned lesv Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: translation Issues related to the Cloud Translation API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants