4

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?

user8542613
  • 745
  • 2
  • 14
  • 25

1 Answers1

1

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.

Anton Kazakov
  • 2,740
  • 3
  • 23
  • 34