Google Home对话流程代理身份验证错误

时间:2018-10-01 10:08:59

标签: java google-app-engine authentication google-cloud-platform dialogflow

错误:-

  

桶:   线程“主”中的异常java.lang.NoSuchMethodError:com.google.api.services.storage.Storage $ Buckets $ List.setUserProject(Ljava / lang / String;)Lcom / google / api / services / storage / Storage $ Buckets $ List;       在com.google.cloud.storage.spi.v1.HttpStorageRpc.list(HttpStorageRpc.java:311)       在com.google.cloud.storage.StorageImpl $ 6.call(StorageImpl.java:272)       在com.google.cloud.storage.StorageImpl $ 6.call(StorageImpl.java:269)       com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:89)       在com.google.cloud.RetryHelper.run(RetryHelper.java:74)       在com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:51)       在com.google.cloud.storage.StorageImpl.listBuckets(StorageImpl.java:268)       在com.google.cloud.storage.StorageImpl.list(StorageImpl.java:257)       在com.example.dialogflow.DetectIntentTexts.main(DetectIntentTexts.java:103)

代码:-

public static void main(String[] args) throws Exception {
    // You can specify a credential file by providing a path to GoogleCredentials.
    // Otherwise credentials are read from the GOOGLE_APPLICATION_CREDENTIALS
    // environment variable.
    GoogleCredentials credentials = GoogleCredentials
            .fromStream(new FileInputStream("/home/agile/karan/ElysiotCredentials/Elysiot-9cxxxxxxxxxx.json"))
            .createScoped(Lists.newArrayList("https://www.googleapis.com/auth/cloud-platform"));
    Storage storage = StorageOptions.newBuilder().setCredentials(credentials).build().getService();

    System.out.println("Buckets:");
    Page<Bucket> buckets = storage.list();
    for (Bucket bucket : buckets.iterateAll()) {
        System.out.println(bucket.toString());
    }
}

0 个答案:

没有答案