As Android projects grow in complexity, it becomes necessary to customize the behavior of the Gradle build tool, allowing automation of repetitive tasks. Particularly, factoring functionality into libraries and creating product flavors allow for much bigger projects with minimal added complexity.
In this project, I created an app with multiple flavors that uses multiple libraries and Google Cloud Endpoints. The app consists of four modules:
- A Java library that provides jokes
- A Google Cloud Endpoints (GCE) project that serves those jokes
- An Android Library containing an activity for displaying jokes
- An Android app that fetches jokes from the GCE module and passes them to the Android Library for display
The following requirements have been implemented.
- Project contains a Java library for supplying jokes
- Project contains an Android library with an activity that displays jokes passed to it as intent extras.
- Project contains a Google Cloud Endpoints module that supplies jokes from the Java library. Project loads jokes from GCE module via an async task.
- Project contains connected tests to verify that the async task is indeed loading jokes.
- Project contains paid/free flavors. The paid flavor has no ads, and no unnecessary dependencies.
- App retrieves jokes from Google Cloud Endpoints module and displays them via an Activity from the Android Library.
- The free app variant displays interstitial ads between the main activity and the joke-displaying activity.
- The app displays a loading indicator while the joke is being fetched from the server.
- The root build.gradle file contains a task that will start up the GCE dev server, run all Android tests, and shutdown the dev server.