如何在窗口上设置GOOGLE_APPLICATION_CREDENTIALS?

时间:2019-05-26 15:48:04

标签: android vision

java.io.IOException:应用程序默认凭据不可用。如果它们在Google Compute Engine中运行,则可用。否则,必须定义环境变量GOOGLE_APPLICATION_CREDENTIALS,指向指向定义凭据的文件。有关更多信息,请参见https://developers.google.com/accounts/docs/application-default-credentials

我已经搜索并尝试了很多这种方式。 总结一下我的尝试方式。

首先。设置环境变量GOOGLE_APPLICATION_CREDENTIALS 第二。 gcloud auth应用程序-默认登录(gcloud下载和cmd) 第三。创建api密钥并输入静态最终字符串CLOUD_VISION_API_KEY

错误继续不断发生。 有很多事情要考虑。 OAuth令牌..但是不会回答。

我想制作图像Web检测器,但在认证阶段被阻止。 请帮助我..我想开心;

java.io.IOException:应用程序默认凭据不可用。如果它们在Google Compute Engine中运行,则可用。否则,必须定义环境变量GOOGLE_APPLICATION_CREDENTIALS,指向指向定义凭据的文件。有关更多信息,请参见https://developers.google.com/accounts/docs/application-default-credentials。         在com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:132)         在com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:127)         在com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:100)         在com.google.api.gax.core.GoogleCredentialsProvider.getCredentials(GoogleCredentialsProvider.java:59)         在com.google.api.gax.rpc.ClientContext.create(ClientContext.java:140)         在com.google.cloud.vision.v1.stub.GrpcImageAnnotatorStub.create(GrpcImageAnnotatorStub.java:84)         在com.google.cloud.vision.v1.stub.ImageAnnotatorStubSettings.createStub(ImageAnnotatorStubSettings.java:120)         com.google.cloud.vision.v1.ImageAnnotatorClient。(ImageAnnotatorClient.java:136)         在com.google.cloud.vision.v1.ImageAnnotatorClient.create(ImageAnnotatorClient.java:117)         在com.google.cloud.vision.v1.ImageAnnotatorClient.create(ImageAnnotatorClient.java:108)         在org.techtown.webfilter.MainActivity.detectWebDetections(MainActivity.java:152)         在org.techtown.webfilter.MainActivity.onActivityResult(MainActivity.java:107)         在android.app.Activity.dispatchActivityResult(Activity.java:7758)         在android.app.ActivityThread.deliverResults(ActivityThread.java:4577)         在android.app.ActivityThread.handleSendResult(ActivityThread.java:4626)         在android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)         在android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)         在android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)         在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1926)         在android.os.Handler.dispatchMessage(Handler.java:106)         在android.os.Looper.loop(Looper.java:214)         在android.app.ActivityThread.main(ActivityThread.java:6981)         在java.lang.reflect.Method.invoke(本机方法)         在com.android.internal.os.RuntimeInit $ MethodAndArgsCaller.run(RuntimeInit.java:493)         在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

0 个答案:

没有答案