In this project, created an app with multiple flavors that uses multiple libraries and Google Cloud Endpoints. The finished app will consist 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
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.
I learned the role of Gradle in building Android Apps and how to use Gradle to manage apps of increasing complexity. I learned to:
- Add free and paid flavors to an app, and set up build to share code between them
- Factor reusable functionality into a Java library
- Factor reusable Android functionality into an Android library
- Configure a multi-project build to compile your libraries and app
- Use the Gradle App Engine plugin to deploy a backend
- Configure an integration test suite that runs against the local App Engine development server
created a Java library that provides jokes. Created a new Gradle Java project Then introduce a project dependency between app and the new Java Library.
Make the button display a toast showing a joke retrieved from your Java joke telling library.
Create an Android Library containing an Activity that display a joke passed to it as an intent extra. Wire up project dependencies so that the button can now pass the joke from the Java Library to the Android Library.
Instead of pulling jokes directly from our Java library set up a GCE development server, and pull jokes from there.
Introduce a project dependency between your Java library and GCE module, and modify the GCE starter code to pull jokes from your Java library. Create an Async task to retrieve jokes. Made the button kick off a task to retrieve a joke, then launch the activity from Android Library to display it.
Added code to test that Async task successfully retrieves a non-empty string.
Added free and paid product flavors to your app. Removed the ad (and any dependencies) from the paid flavor.
Display the ad after the user hits the button, and before the joke is shown.
Add a loading indicator that is shown while the joke is being retrieved, and disappears when the joke is ready.