We more often than not re-use code when developing software. For code to be reused when working in Java, we can package it into classes, packages, modules (read gradle-modules), or an artifact.
In Java, we call these artifacts JARs while in Android they become a bit more complicated and independent to become AARs. AARs contain drawables, strings, layouts, values, assets and even the
AndroidManifest.xml. However, to truly re-use the code in an AAR we need to know:
- What the code does
- How to call it
- What to pass to it
The aim of this blog post is to outline how to develop and support Android libraries that are usable by other developers. The fact is that there are a lot of libraries developed that achieve what we want. However, the difficulty of using these libraries — often they are challenging to import, let alone use — deters developers from taking advantage of them.