Setting Up the Development Environment

This page describes how to set up your development environment to build and deploy your backend API using Cloud Endpoints.

The recommended way to add a backend API to a new or existing Android app is to use Android Studio, which sets up your development environment for you. If you are building an iOS or Javascript app, the following directions explain how to set up a development environment that uses Maven.

To set up your development environment:

Android Studio

If you use Android Studio and Cloud Tools for Android Studio to build your app and backend API, Android Studio automatically configures the development environment for you.

For instructions on how to add a backend API to your app in Android Studio, see Add a Cloud Endpoints Module in the Cloud Tools for Android Studio documentation.

Maven

  1. Install Java 7.
  2. Set your JAVA_HOME environment variable to the path of your JDK installation. If you are a bash user, the following considerations apply:
    • For a typical Linux installation, add a line similar to the following to your .bashrc file:

      export JAVA_HOME=/usr/local/tools/java/jdk1.7.0_45.jdk
      
    • If you use Mac OS X and the default Terminal app, your shell session doesn't load .bashrc by default. So you may need to add a line similar to the following to your .bash_profile:

      [ -r ~/.bashrc ] && source ~/.bashrc
      
    • If you use Mac OS X but don't use the default terminal app, for example, you use a terminal management app such as tmux, you may need to add a line similar to the following line to your .bashrc file:

      export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
      
  3. Install Maven.
  4. Build the project using the App Engine Maven artifact endpoints-skeleton-archetype to generate the required files and configuration.
    1. In a terminal window, change to the directory where you want to build the project.
    2. Invoke the following Maven command:
      mvn archetype:generate -Dappengine-version=1.9.44 -Dfilter=com.google.appengine.archetypes:
      
    3. Enter the number 2 to select the archetype remote -> com.google.appengine.archetypes:endpoints-skeleton-archetype from the list of App Engine archetypes.
    4. Accept the default to use the most recent version.
    5. When prompted to Define value for property 'groupId', enter the namespace. The convention is to use a namespace starting with the reversed form of your domain name, for example: com.example.backend.
    6. When prompted to Define value for property 'artifactId', supply a project name.
    7. When prompted to Define value for property 'version', accept the default value.
    8. When prompted to Define value for property 'package', accept the default value.
    9. When prompted to confirm your choices, accept the default value (Y).
    10. Wait for the project to finish generating, then open the resulting project layout. The pom.xml file contains the configuration and dependencies needed for your backend API.

What's Next?