This page shows you how to add an App Engine Java Servlet module to your project in Android Studio.
To add the module:
-
Start Android Studio and open the project for the Android app that needs
the new backend.
If you have not installed Android Studio or set up your environment yet, see the Quickstart for details.
-
Right-click on your project and select New > Module.
-
Select Google Cloud Module from the list and then click Next.
Select App Engine Java Servlet Module, and then supply the remaining information in the New Google Cloud Module form:
-
Supply a module name for your backend; this name will be displayed and used in your Android Studio project.
-
Supply a package name. This package name will be used for all classes imported from this template.
-
Select the client module (containing your Android app) in this project. This module will be automatically set up to have the right compile and build dependencies to be able to call your newly generated backend.
-
Click Finish to generate the new backend.
-
-
Select Tools > Android > Sync Project with Gradle Files to sync the project.
At this point, you've created a new buildable and runnable backend module for
your Android Studio project and added it as an additional dependency in your
project's settings.gradle file.
In particular, a new Gradle module with your specified module/package name has been added to your project containing your new backend. All of the required dependencies/permissions have been automatically set up for you.
Using the module
For detailed instructions on how to connect your Android app to the backend,
how to debug and test locally, and how to deploy, see the appropriate README
in the GitHub repository:
- App Engine Java Servlet Module
- App Engine Java Endpoints Module
- App Engine Backend with Cloud Messaging
Suggesting changes or enhancing the backend module templates
If you want to make suggestions to improve or enhance these templates, visit the GitHub repository and submit a pull request.
What's next
- Learn how to add new projects to Cloud Source Repositories from within Android Studio, and check out existing projects.
- See the article Mobile App Backend Services for samples and a discussion of design and implementation options.