Micah Simmons Micah Simmons - 1 year ago 262
Android Question

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.

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.

I then went onto the Batch documentation here but the compiled gradle library lacks the Calender class used in this example code:

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

public void onSuccess(Calendar calendar, HttpHeaders responseHeaders) {

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


Calendar client = Calendar.builder(transport, jsonFactory, credential)
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);


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. 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?

Thanks in advance

mjn mjn
Answer Source

As explained in your linked page:

A complete example of batch using the Calendar API is available in the calendar-cmdline-sample.

The Calenadar API home page is at:


There it is shown that the Gradle script requires:

repositories {

dependencies {
    compile 'com.google.apis:google-api-services-calendar:v3-rev191-1.22.0'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download