简体   繁体   English

通过Gradle使用“ Java的Google Cloud Datastore API客户端库”

[英]Using 'Google Cloud Datastore API Client Library for Java' with Gradle

I am trying to use the Google Cloud Datastore for a simple read/write function in an Android app. 我正在尝试将Google Cloud Datastore用于Android应用程序中的简单读取/写入功能。

I went on to this page and compiled this " compile 'com.google.apis:google-api-services-datastore:v1beta2-rev31-1.22.0' " gradle dependency along with the MavenCentral repository. 我转到页面并编译了这个“ compile 'com.google.apis:google-api-services-datastore:v1beta2-rev31-1.22.0' ” gradle依赖项以及MavenCentral存储库。

I then went onto the Batch documentation here but the compiled gradle library lacks the Calender class used in this example code: 然后,我在这里查看了批处理文档但是编译的gradle库缺少此示例代码中使用的Calender类:

JsonBatchCallback<Calendar> callback = new JsonBatchCallback<Calendar>() {

  public void onSuccess(Calendar calendar, HttpHeaders responseHeaders) {
    printCalendar(calendar);
    addedCalendarsUsingBatch.add(calendar);
  }

  public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
    System.out.println("Error Message: " + e.getMessage());
  }
};

...

Calendar client = Calendar.builder(transport, jsonFactory, credential)
  .setApplicationName("BatchExample/1.0").build();
BatchRequest batch = client.batch();

Calendar entry1 = new Calendar().setSummary("Calendar for Testing 1");
client.calendars().insert(entry1).queue(batch, callback);

Calendar entry2 = new Calendar().setSummary("Calendar for Testing 2");
client.calendars().insert(entry2).queue(batch, callback);

batch.execute();

What other dependencies do I need to compile to get that class? 为了获得该类,我还需要编译其他哪些依赖项?

I have googled around and looked over other stackoverflow questions here and the sample projects here and I can't seem to find a simple demo of how to do CRUD operations with Google Datastore. 我用Google搜索周围,看着其他计算器问题, 在这里和样本项目在这里和我似乎无法找到如何做CRUD操作与谷歌数据存储一个简单的演示。 Can someone please point me in the direction of some comprehensive documentation/ a tutorial that explains how to perform CRUD operations on Google Datastore without using Google App Engine? 有人可以指出一些综合性文档/教程的方向,该教程解释了如何在不使用Google App Engine的情况下对Google Datastore执行CRUD操作吗?

Thanks in advance 提前致谢

As explained in your linked page: 如您的链接页面中所述:

A complete example of batch using the Calendar API is available in the calendar-cmdline-sample. calendar-cmdline-sample中提供了使用Calendar API的批处理的完整示例。

The Calenadar API home page is at: Calenadar API主页位于:

https://developers.google.com/api-client-library/java/apis/calendar/v3 https://developers.google.com/api-client-library/java/apis/calendar/v3

There it is shown that the Gradle script requires: 那里显示了Gradle脚本需要:

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.apis:google-api-services-calendar:v3-rev191-1.22.0'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Cloud Datastore客户端库对Google Cloud Datastore进行单元测试 - Unit Testing Google Cloud Datastore using Cloud Datastore Client library 带有Gradle的Google云端存储Java客户端库 - Google Cloud Storage Java Client Library with Gradle Google Cloud Datastore API Java - Google Cloud Datastore API Java Google Cloud Java客户端库未通过Gradle编译 - Google Cloud Java Client library not compiling through gradle Google Cloud Datastore Java库中的allocateIds在哪里? - Where is allocateIds in the Google Cloud Datastore java library? Google Cloud Datastore Java API线程安全吗? - Is the Google Cloud Datastore Java API threadsafe? 使用Datastore Java API的WHERE子句(2-3个过滤器)查询时,Google Cloud Datastore Kind无法返回所有记录 - Google cloud Datastore Kind unable to return all records when queried with WHERE clause ( 2 - 3 filters ) using Datastore java API's 如何在Java中使用Gradle使用Google Cloud API - how to use google cloud api in java with gradle 我们如何使用Google Cloud Java API进行数据存储不等式和“IN”过滤? - How do we do Datastore inequality and “IN” filters using the Google Cloud Java API? 使用Google Cloud Dataflow的数据存储区Java API将属性设置为null吗? - Set a property to null with Google Cloud Dataflow's Java API for Datastore?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM