By referencing the code about .properties
loading in build.gradle
, I'd like to know how to ignore when the file is not existed.
Currently, below build.gradle
file throws FileNotFound exception and cannot proceed compile.
def Properties properties = new Properties()
try{
properties.load(project.rootProject.file("developer.properties").newDataInputStream())
}
android {
defaultConfig {
buildConfigField 'boolean', 'PrintLog', properties.getOrDefault("print.log", "false")
}
}
What I want is to make compile whether developer.properties
is existed or not. How can I achieve this?