Android.Gradle: Is it possible to get current module name programmatically?

Viewed 1286

Android Studio 2.3.3, Gradle 4.2.

In my app/build.gradle

myProp.load(new FileInputStream(rootProject.file("app/keystore.properties")))

OK. It's work. But I want to remove hard code name of module (in this example this is a "app")

So I need to get current module name programmatically. Something like this:

myProp.load(new FileInputStream(rootProject.file(project.currentModuleName + "/keystore.properties")))

Is it possible?

1 Answers

You can store buildType/buildFlavor name as BuildConfig value. And use it like BuildConfig.your_variable_name. To get current flavor/buildType use this solution.

Related