playground-android

Introduction: Opinionated Android app starter template. I pick the best choice(s) of libraries & solutions (imo) and keep it ready for forking off and building your next Android app.
More: Author   ReportBugs   OfficialWebsite   
Tags:

This is a template project for Android development. I use it as a way to test new concepts or integrate libraries that are otherwise hard in a more complex project.

Some of the concepts implemented here:

Getting started

  1. Clone the repo in your android folder

    git clone https://github.com/kaushikgopal/playground-android.git android
    cd android
    # assuming you are already tracking in git
    trash .git
    trash .idea
    
  2. Run the package rename script

    ./rename_package.sh app.awesome.android
    
  3. Change project name

  4. in settings.gradle.kts change rootProject.name = "MyApp"
  5. in .idea/.name add entry MyApp
  6. in your strings.xml change app_name from Playground to MyApp

  7. Clean & Rebuild app

    make clean
    make
    

    Ready to go!

App module diagram (multi-module setup)

Below diagram should give you an idea of how the inter module dependencies are setup. In practice, when you add feature modules it is pretty straightforward as the core requirements are already setup. See the Landing feature's build.gradle.kts file as an example for how simple the build script for new features land up being.

The dependency graph is widest at the top (:app module) and becomes more focused and self-contained as you move down through domain and common modules. So modules at the bottom have lesser dependencies and are more self-contained.

App module diagram

  • new features are added to :features module
  • the core :app module itself assembles all the dependencies (and is intentionally lean)
  • template.feature = custom gradle plugin that sets up a fully functional feature for your app
  • template.android = custom gradle plugin that has the things you need for a pure android lib
    • think jvm target, minSDK etc. that you don't want to repeat everywhere
  • :common modules are shared but can be hot-swapped with another implementation (possible)
  • :domain modules are specific to the app but also shared (but not intended to be swapped out)

I talked about this in ep #252 of Fragmented

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools