Add an assembly configuration field to enter your subproject of the top-level assembly file.
It will be something like this:
subprojects { afterEvaluate { project -> if (project.hasProperty("android")) { android.defaultConfig { buildConfigField 'String', 'USER_AGENT', "\"Android-agent\"" } } } }
Then, in your BuildConfig files of each module, you will see:
public static final String USER_AGENT = "Android-agent";
PS Perhaps this is not the best implementation of detecting subprojects in android, but the best I know.
source share