Q:

How can I get Gradle module name programmatically

Is it possible to obtain Gradle's module name programmatically in Java code? 
I need it to access module's build files under the MODULE_NAME/build/intermediates directory, but hardcoding module name is a bad idea. 

A:

To get the current's module name you can just access Gradle's project object
project.name

Will return, for the module app

app

See: https://docs.gradle.org/current/userguide/writing_build_scripts.html

