Achieve Mono-Repo-like development experience in Multi-Repo Android projects

Save time by automating maven local publish across projects

The familiar problem

Many Android developers know the pain of inadequate library development experience provided by the AndroidStudio/Google. Jeroen Mols has a great talk where he goes into details and provides workaround solutions for many of them.

Project set up

Imagine the following project set up:

Testing the changes

Now let’s say you made changes in repositories 3 and 2, how should we test it in our sample app?

Automating local publish

At last, let’s create that automation script I teased in the title. In your repository that contains the main sample app (repository 1 in our imaginary case), create a folder named scripts or something to house the following bash code. Make sure to update the path and artifact names to something that matches your project.

# Step 1
rm -rf repository2 &
rm -rf repository3
# Step 2
./gradlew publishToMavenLocal
# Step 3
./gradlew publishToMavenLocal
# Step 4
./gradlew prepareKotlinBuildScriptModel
  1. Remove any outdated artifacts from the local maven repository
  2. Builds and publishes project in the repository 3
  3. Builds and publishes project in the repository 2
  4. Syncs sample app project (repository 1) with latest changes
allprojects {
repositories {

tasks.whenTaskAdded { task ->
boolean isDebugBuild = == 'assembleDebug'

if (isDebugBuild) {

Finishing thoughts

  • While far from perfect, the above setup massively decreased the time we spent when doing quick iterative changes.
  • In addition to saving developer time, it is also helpful for new members to onboard as they don’t have to understand how these projects are connected under the hood.
  • The current bottleneck is that each project is rebuilt on every run. Once the library projects get big enough, we may introduce focus plugin in the mix to further speed up the process.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store