Thuy's Blog

Name your Gradle modules in CamelCase

January 30, 2017

I’ve seen lots of Android projects on GitHub naming in delimiter-separated words like my-first-module instead of in CamelCase like MyFirstModule (or myFirstModule). I suggest you follow the CamelCase convention. There’s actually a benefit that you can take advantage of Gradle’s task name abbreviation if you want to execute some Gradle tasks on a specific module on terminal. For example, assume you want to clean, then assemble the MyFirstModule module, instead of typing:

./gradlew MyFirstModule:clean MyFirstModule:assemble

You can type:

./gradlew MFM:clean MFM:assemble

They both do the exact same thing.

Gradle is unable to recognize an abbreviation of a module named in delimiter-separated words. Future releases of Gradle may change but at least with v3.3 which I was using, it’s unable.


Thuy Trinh

Written by Thuy Trinh who lives and works in Frankfurt, Germany building robust Android apps. You should follow him on Twitter