Generating a Client Library for Android

Cloud Endpoints Frameworks v1 has been deprecated and will be shut down on August 2, 2018. We recommend that you use the latest version of this feature, which is renamed to Cloud Endpoints Frameworks for App Engine. This new version supports App Engine standard environment, provides lower latency, and has better integration with App Engine. For more details, see Migrating to 2.0.

This page describes how to generate a client library from your backend API. Your Android app using this client library to call the API.

Before you begin

Before you can generate a client library, you must have already annotated the backend API code. For an example of how to annotate your backend API code, see the backend API with Maven tutorial.

Generating a client library for an Android app

To generate a client library for an Android app:


If you created your backend API in a Maven project using the App Engine Maven artifacts, you can generate the client library as follows:

  1. Invoke the following command in the directory containing your project pom.xml file:

  2. mvn appengine:endpoints_get_client_lib
  3. Locate the generated client library source directory and files, which are inside your project root directory at this subdirectory location: /target/endpoints-client-libs/[yourProjectName] and change directory to this location.

  4. Invoke Maven to build the client library:

    mvn install

  5. This builds the required class files and creates the JAR file you need to add to your client project. The JAR file is located inside your current directory at this subdirectory location:


  6. Add the client library JAR to the Android app as described in Calling Endpoints from an Android App.

Endpoints CLI

The following instructions demonstrate how to use the Endpoints command-line tool to generate a Gradle client bundle from a Maven project. If you use Eclipse, the project layout will be slightly different.

If you are running the commands from Windows, use endpoints.cmd instead of and omit the continuation character "\" and carriage returns in the command.

  1. If you haven't already done so, build the backend API.

  2. Invoke the Endpoints command line tool similarly to the following:

    appengine-java-sdk-x.x.x/bin/ get-client-lib \
        --war=target/helloendpoints-1.0-SNAPSHOT \
        -bs gradle

    where we are building a Gradle bundle and where target/helloendpoints-1.0-SNAPSHOT is the relative or absolute path to the target build directory containing WEB-INF/appengine-web.xml and the compiled backend classes.

    Compiled classes

  3. When successful, the tool displays a message similar to:

    INFO: Successfully processed /usr/local/directory/helloendpoints/target/helloendpoints-1.0-SNAPSHOT/WEB-INF/appengine-web.xml
    API client library written to ./

    The client library bundle is written to the current directory unless you specify some other output directory using the --output option.

  4. Add the client library JAR to the Android app as described in Calling Endpoints from an Android App.

Client Library Bundles

This bundle is the Java library be used in your client to call the backend API; it provides your client with all of the Google API client capabilities, including OAuth.

What's Next?

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Endpoints Frameworks for App Engine