Udacity Android Nanodegree Project FOUR submission : Gradle for Android project
In this project, an app is created with multiple flavours that uses multiple libraries and Google Cloud Endpoints. The app consists of four modules:
- "javajokes" :
A Java library that provides jokes. The main module has a project dependency between the app and the new Java Library. - "jokedisplay" :
An Android Library containing an activity for displaying jokes. The main module has a project dependency between the app and the new Android Library. When the button is selected a joke from the Java Library is passed to the Android Library to be displayed. - backend_v2 :
A Google Cloud Endpoints (GCE) project that serves those jokes. The main module has a project dependency between the app and the GCE module. An Async task is used to retrieve jokes from the App Engine. - app:
An Android app that fetches jokes from the GCE module and passes them to the Android Library for display.
The project also has the following features: - Connected tests to verify that the async task is loading jokes.
- Project contains paid/free flavors. The paid flavor has no ads.
###Initial code The initial code can be found in the course repository.
The initial request was for a Google Cloud Endpoints Module to be created in the Android Studio IDE. However, at the moment of development and starting from Android Studio 3.0, the ability to create an App Engine backends had been removed.
Several changes to the GCE module gradle files have to be carried out in order to transition the project to the new framework version. Instruction at the Transition Android Projects readme page were followed.
The library was deployed using the App Engine Plugin at the terminal using the following resources:
- App Engine Plugin readme pages
- App Engine Standard & Google Cloud Endpoints Frameworks & Java readme pages
The free app variant display interstitial ads between the main activity and the joke activity
A loading indicator is shown while the joke is being retrieved and disappears when the joke is ready.
A connected test was implemented to check that the async task successfully retrieves a non-empty string.
Also a Gradle task was added to run test locally using the GCE dev server. The runDaemonServerAndroidTest task carries out the following:
- Launches the GCE local development server
- Runs all tests
- Shuts the server down again
To run the task, use the following command from the project root folder:
$ ./gradlew runDaemonServerAndroidTest
This is a list of the Google Cloud libraries used in the project:
Admob libraries
play-services-ads
google-http-client-android
GC Endpoint Framework v2 libraries for appengine deployment
endpoints-framework
endpoints-management-control-appengine
endpoints-framework-auth
- GC Endpoint Framework v2 client libraries
google-api-client
google-http-client-android
For a list of support and other Android libraries, see the build.gradlefile